Now that you have the basics of remote control down it's time to learn how to use the remote to drive your S3. For this simple version, you will use the Channel -, Channel+, Volume -, Volume +, and the Mute buttons.
First, recall or retest to find the code sent for each of the Sony IR Remote buttons. Review the Test the Receiver and Remote tutorial if needed.
- Begin a new project in BlocklyProp.
We're going to use Channel+ to move forward, Channel- to move backward, the Volume- to rotate counterclockwise (CCW), the Volume+ to rotate clockwise (CW), and the Mute button to stop driving.
- Snap together blocks to create the code below.
- Save, compile, and then load the program to EEPROM on your S3.
Now take your S3 for a little drive around. Does everything work as you expected? If not, find the mistakes in your code (a process called debugging) and correct them. Remember that you should have a direct line between the Sony IR Remote and the S3’s IR receiver, so you need to always be positioned more or less in front of the S3. That may mean running around a bit (or a lot), depending on the lighting of your room or how many of these remote S3's are running at once.
Why would lighting and other robots make a difference? Some fluorescent lights (and even bright sunlight) can cause signal interference, sometimes preventing your receiver from responding correctly to your remote. In the case of other robots, any Sony-programmed remote can send a signal to your robot, meaning another student can control your robot by accident (or maybe on purpose) if their remote is pointed at your receiver.
Did You Know?
The terms "bug,” “debug,” and "debugging" are popularly attributed to Admiral Grace Hopper in the 1940s. Hopper was a pioneer of computer programming, inventing the first compiler for any computer programming language. She popularized the idea of machine-independent programming languages, which is what Blockly and BlocklyProp are. While she was working on a Mark II Computer at Harvard University, her associates discovered a moth stuck in a relay and thereby impeding operation, whereupon she remarked that they were "debugging" the system. Debugging is the process of finding and resolving of defects that prevent correct operation of computer software or a system.
- Add LED feedback, sound, or some other simple feature to the program above.
Be creative! Remember that you, as the programmer, are in charge.