< Unit 6 - Physical Computing ('22-'23)

Lesson 9: Combining Inputs and Outputs

45 minutes

Overview

In this lesson, students combine inputs and outputs across both the circuit playground and the app screen. For example, students may use dropdowns or sliders to make the LEDs on the circuit playground change. Or, students may use the buttons on the circuit playground to update elements on the screen. This lesson also extends how students use variables and if-statements to make more complex decisions based on user input. There are no new coding commands or circuit playground features in this lesson, but students are combining many elements from previous lessons in new ways.

Question of the Day: How can I use inputs and outputs from both the circuit playground and the app screen?

Assessment Opportunities

  1. Use inputs from app design elements to update screen elements or produce output on the circuit playground

    Code Studio: see rubric on the assessment level

  2. Use inputs from the circuit playground to update screen elements or produce output on the circuit playground

    Code Studio: see rubric on the assessment level

  3. Use variables and if-statements for complex user interaction

    Code Studio: see rubric on the assessment level

CSTA K-12 Computer Science Standards (2017)
    • 2-AP-11 - Create clearly named variables that represent different data types and perform operations on their values.
    • 2-AP-13 - Decompose problems and subproblems into parts to facilitate the design, implementation, and review of programs.
    • 2-AP-19 - Document programs in order to make them easier to follow, test, and debug.
    • 2-CS-02 - Design projects that combine hardware and software components to collect and exchange data.
    • 2-CS-03 - Systematically identify and fix problems with computing devices and their components.

Agenda

Objectives

Students will be able to:
  • Use inputs from app design elements to update screen elements or produce output on the circuit playground
  • Use inputs from the circuit playground to update screen elements or produce output on the circuit playground
  • Use variables and if-statements for complex user interaction

Preparation

  • Prepare a board and USB cable for each pair of students
  • (Optional) consider preparing external reference materials from previous lessons for students, such as a Word Wall or Reference Packet, that students can access.
  • Check the "Teacher's Lounge" forum for verified teachers to find additional strategies or resources shared by fellow teachers

Links

Heads Up! Please make a copy of any documents you plan to share with students.

For the teachers
For the students

Teaching Guide

Warm Up (5 minutes)

Distribute: Pass out a board and USB cable to each pair of students. Let students know that they should not yet plug the boards in.

Prompt: Create a chart like the one below. Write down all the design elements or circuit playground components that go in each box

Share: Have students share with a neighbor, then with the whole class. As students share, fill in the chart in the front of the room

Discussion Goal: This prompt synthesizes the different inputs and outputs students have been learning about throughout the unit so far. A complete list is given in the picture below (click to enlarge). Help students uncover each item in the chart.

Remarks

We’ve seen a lot of different ways to get input from the user, and a lot of choices for how we can display output to the user. In today’s lesson, we’re going to see how we can combine these different forms of input and output to make more complex apps.

Video: Show students the Input / Output Devices video.

Activity (35 minutes)

Transition: Send students to Code Studio

Teaching Tip

Guide to Programming Levels: Additional guidance for programming levels is provided in the CSD Guide to Programming Levels. This document includes strategies and best-practices for facilitating programming levels with students.

Discussion Goal

Student responses may include:

  • The screen is using a dropdown menu and a getProperty block for input to see whether the LED should blink or pulse
  • The screen is using a label and a setText block for output to display whether the light is on or off
  • The circuit playground is using the buttons and an onBoardEvent block for input to turn on or off the lights
  • The circuit playground is using the colorLEDs blocks as output to turn on the lights

Students will also need their circuit playgrounds for this level. If student’s boards aren’t working, have them press the Setup button in the maker app or visit https://studio.code.org/maker/setup on a Chromebook.

Assessment Opportunity

Formative Assessment: This level can be used as a formative assessment. A rubric is provided in the level, and written feedback can be given to students. Click here to learn more about giving feedback to students.

Wrap Up (5 minutes)

Prompt: What’s an example of a device you’ve seen that combines inputs and outputs between an app and a device? For example, you might press buttons on a device and then something changes on the app.

Discussion Goal: This prompt foreshadows the project introduced tomorrow, where students develop their own projects that explore human/device interaction. Students may think of examples where they enter information on a keypad or controller and something changes on a screen. Or, students may think of examples where they press buttons on a touchscreen and something physically happens with a device, such as complex vending machines that select items based on screen inputs.

Creative Commons License (CC BY-NC-SA 4.0).

This work is available under a Creative Commons License (CC BY-NC-SA 4.0).

If you are interested in licensing Code.org materials for commercial purposes contact us.