Sign in:

Tutorial #12: One thing leads to another

Lesson Recap:

By creating rules that closely connect the behavior of two parts we can actually change the behavior of our entire robot! Such small changes can have very large impacts in systems. The more complex the system the more possible ways the system can change!

Let’s change the behavior of the robot your built in Tutorial #11 by creating a direct connection between the Brightness Cubelet and the Flashlight Cubelet.

Instructions:

  1. In this tutorial you are going to expand on the robot that you created in Tutorial #11. You will create a program for the Flashlight Cubelet so that it only listens to Block Values from the Brightness Cubelet. In addition, we are going to set the Flashlight to respond to the inverse of the Block Values from the Brightness Cubelet. If you need to rebuild your robot click here repeat Tutorial #11.
  2. Next, you’ll need to download the cubelets_tutorial_12.cubelet starter file.

  3. Load the “cubelets_tutorial_12.cubelet” file. Click the load icon in the toolbar. Then follow the system dialogue to select the proper file.

  4. Arrange the blocks to build a program for your Flashlight Cubelet. The goal is to make a program that lights up the flashlight whenever the Brightness Cubelet is in a dark room.
  5. See if you can build this program without help. Don’t forget to specify the Brightness Cubelet’s Block ID in your program. If you need a few hints click here.
    1. HINT: First you will need to find the Block ID for your Brightness Cubelet. Select the Brightness Cubelet and look in the block information for the Block ID. Carefully write down this number.
    2. Start your program by setting the “block_value” variable to the block value for the Brightness Cubelet ID number you just wrote down.
    3. In the next line, set the actuator value to the inverse of the block value variable.
  6. Think you got it? Let’s find out. Select the Flashlight Cubelet from the Block Map and click “Program Selected Cubelet.”
  7. Once Cubelets Blockly has finished updating your Flashlight Cubelet, take your robot to a safe flat area and observe the new behaviors you created with these simple rules. Do you see how the direct connection between the Brightness and Flashlight Cubelets has changed the behavior of the robot?
  8. When you’re finished observing your robot, return your Flashlight and Drive Cubelet back to default settings. Simply select each Cubelet from the Block Map and click “Restore to Default.”