Discussion Points

 
 
Getting Information from a Light Sensor

Whole Class Activity  

In this class discussion you will demonstrate how two robots communicate with each other. The sample programs provided, Sender and Receiver work only if the sender has a light sensor and the receiver can move. Depending on when you decide to introduce this lesson, students may still have their Roverbots built, or they may already have other robots such as the Acrobot or the Inventorbot ready. Be sure to choose one robot with a light sensor (or simply add a light sensor to it) and one that moves.

Set the robots so that they are within communication range. Note that they do not have to be pointing at each other in order to communicate. Turn on both robots and set them to the appropriate program slots, holding Sender and Receiver. Tell the students that you are going to shine a light at one robot and ask them to pay attention to what happens. If needed, repeat this part of the demonstration, pointing out that both RCXes are running before you shine a light at one of them.

Students will soon realize that shining a light at one robot generates a response in the other robot. You can show them that the longer you wait before shining a light at one, the longer the other robot waits before moving.

Tell the class that, indeed, the robots communicate. Explain that one robot sends a message and the other robot has a program set to receive the message and act on it.

Show the class Transparency # 8. Explain that when two robots communicate, one sends a message and the other one is set to receive a message. Point out that the message is just a number; it has no meaning except for setting off a stack of commands in the receiverís program.

It is important that students understand that a robot can send and receive messages and that an old message must be cleared before a new message can come in. This concept of clearing a variable may be foreign to your students. Consider using a container analogy here:

1)       Write a short set of instructions on a piece of paper (e.g., touch your forehead 3 times) and tape it to a small container such as a cup, a jar, or a box. 

2)       Write the range 10 to 20 on a label and tape it to the container.

3)       Write some numbers on pieces of paper, small enough to fit in the container and large enough for the students to see. Be sure to have some numbers between 10 and 20 and some that are outside that range.

4)       Tell the class that you will carry out the instructions attached to the box each time a message within range arrives.

5)       Emphasize that thereís one rule: there can only be one message in the box at a time. If the box is occupied, a new message canít come in.

6)       Put the first number in the box and ask the class:

a) Is the number within the set range?

b) Should I touch my forehead 3 times?

7)       Leaving the card in the box, try inserting another message as you remind the class of the ruleóone message at a time. It will be obvious to the students that the old message has to be cleared before a new one can come in.

8)       Tell the class that the command to clear the message box is called Clear IR Message. Write this command at the end of your set of instructions and repeat the demonstration one more time.

Have students work in small groups, coordinating the communication between their RCXes. The Programming Highlights below explain the commands students must use to set up their senders and receivers.

 

 

Return to Top