Sign in:

Tutorial #11: LO 10.29.1969

Introduction:

Block IDs are numbers that identify each and every Cubelet. Think of Block IDs like fingerprints. Your fingerprints are unique to you they are one of the ways that we can tell you apart from other people. The Block ID is sort of like a fingerprint for Cubelets. Every Cubelet has their own Block ID. The Block ID allows us to tell the difference between one Cubelet and another. We can use the Block IDs to send specific information between blocks without affecting the other Cubelets in our robot. Let’s explore how using Block IDs can change the way a robot behaves!

Instructions:

  1. In this tutorial you are going to expand on the robot that you created in Tutorial #10. You will create a program for the Drive Cubelet so that it only listens to Block Values from the Distance Cubelet. If you need to rebuild the Tutorial #10 robot click here for instructions.
  2. First, you’ll need to download the cubelets_tutorial_11.cubelet starter file.

  3. Begin by looking at the Block Map to find the Block ID for the Distance Cubelet. Click on the Distance Cubelet in the Block Map and look in the block information section below for the Block ID. Carefully write this number down and double check it to make sure you copied it correctly. We’ll be using that number shortly.
  4. Load the “cubelets_tutorial_11.cubelet” file. Click the load icon in the toolbar. Then follow the system dialogue to select the proper file. This tutorial file has groups of code blocks arranged from top to bottom to make it easier to assemble each component.

  5. Arrange the blocks we’ve placed on the canvas so they set the block value variable equal to Block Value for your Distance Cubelet’s ID. (This is the number you wrote down.)
  6. Excellent! Now use the menu to find the two blocks you’ll need to create the next line in the program. The next line of code should set the action value to the block value. If you need help, click here for a hint.

    HINT: You can find the “set actuator value to” block in the Acting menu and the “item” block in the Variables menu. Once you’ve placed the “item” block use the dropdown arrow to select “block_value.”

  7. That’s it! Pretty simple program right?
  8. Select the Drive Cubelet and click “Program Selected Cubelet.”
  9. After Cubelets Blockly has finished updating your Cubelet, take your robot to a large flat surface and observe how your new rule has changed the way the robot behaves. Does your new robot behave the same as the robot you built in Tutorial #10? Do you see how the Distance Cubelet is directly controlling the Drive Cubelet? What is happening with the Flashlight Cubelet? Is it still using the weighted average?
  10. When you’re finished playing with your robot, keep it assembled just the way it is because we are going to use it again in Tutorial #12!