REVIEW OF ROBOT C When you open a new file in Robot C, you must go to the “MOTORS and SENSORS SETUP” page before you write your code
REVIEW OF ROBOT C Once your new file is open, remember that your program code always needs to be written between the two curly brackets on the screen
NATURAL LANGUAGE COMMANDS We will only use 4 of the Natural Language commands when we program, but each of these commands has a number of choices
MOVEMENT Commands that allow you to control individual motors
SPECIAL Commands that control the more unique VEX Hardware – LED’s and Flashlights
UNTIL Commands that allow you to create behaviors where the robot acts “until” a certain event. For example, Button Press Potentiometer Value
WAIT Commands that wait for an elapsed amount of time. The next command will run after the timer is done.
ROBOTC PRACTICE PROGRAM You may notice warnings or errors. Make sure you spell motor and sensor names exactly as defined in Motors and Sensors setup. A ; is needed at the end of each line of code. Don’t forget every open parenthesis needs a closing parenthesis. What is wrong with line 31?
WHAT’S WRONG WITH THIS CODE? Missing the semicolon.
WHY WON’T THE MOTOR STOP? Should say “leftMotor”, not “rightMotor”.
WHY WON’T THE LED TURN ON? There is nothing between the “Turn on” and “Turn Off” commands, so the LED doesn’t stay on at all.
DIGITAL SWITCHES Digital Switches are either ON or OFF. The command that will always work for these switches is “untilBump” LIMIT SWITCH BUMP SWITCH
YOUR WARM UP PROGRAM 1. Write a program so that a motor turns on when the limit switch is pressed. 2. After 2 ½ seconds have that motor turn off and the other motor turn on in the opposite direction 3. Press the bump switch to turn off the second motor.