Adding Interactivity

In this activity, you'll bring your pet to life with code.
Mary stopped reviewing here for now. --MF, 3/15/22

Collect Materials

Gather Materials

To make your pet interactive, you will need to use at least two different inputs that cause at least two different outputs. Consider the following inputs and decide which one to use to enhance your pet’s personality or story.

Create with Code

    Need to include link to MicroBlocks again. copy from L1. --MF, 3/16/22

    Open MicroBlocks in a Chrome browser.

    Also, are we having them create a new project? I think we should, and if so, we should tell them. Will they need to load the libraries again? --MF, 3/16/22
  1. Open MicroBlocks in a Chrome browser and start a new project. Load the additional libraries by selecting Library, then LED Display.ubl and Basic Sensors.ubl.
  2. Use a when block to start your script.
    when block in MicroBlocks
  3. Select an input for your interactive pet. Note that you'll need to include an inequality with light level and tilt x. Experiment with different values to trigger the script (100 may not be the right value). For a reminder about inequalities, check out 1.6.2, 1.6.3, and 1.7.
    when block in MicroBlocks
  4. Create an animation using the LED display, wait, and repeat blocks.
    LED display, wait, and repeat blocks in MicroBlocks
  5. If you want your pet to make sound.... play ♪ pitch: () beats: ()
In this activity, you created an interactive pet using code, paper, and storytelling.