Sample Programs
Program 8
Purpose: Learn to use the Timer/Counter for timing. This program flashes a LED at a specific rate while reading sensors.
Program: Timer
Extensions:
oChange the flash rate.
oAdd more code to the loop, e.g. showing sensor values. Notice that the flashing still maintains its rate, with no
changes necessary. Challenges:
oModify your EEPROM program to use the timer instead of WaitMs when showing sensor readings. o Read sensors for 10 milliseconds and calculate the average value.
Program 9
Purpose: Learn how to use proportional steering to follow a line.
Program: LineFollow
Extension: Tune values for your robot. Adjust the light thresholds (use ADCPrint to see sensor values). Adjust the scaling proportion for steering.
Challenge: Go faster without falling off the line.
Program 10
Purpose: This program shows how to implement the states involved in detecting and identifying a junction. It will determine which options are available (left, right, forward), then stop.
Program: Junction
Extension: Tune values for your robot. Challenges:
oDetect end of maze (solid 6” diameter black circle).
oUse sensor sample averaging
Program 11
Purpose: This program shows how to implement the states involved in turning at a junction.
Program: Turn
Extension: Tune values for your robot.
Challenge: Go faster!
Program 12
Purpose: This program shows how to use a table to store a sequence of control commands for the robot. It also demonstrates how to store constant data (the table) in program memory (Flash) instead of the default SRAM.
Program: DeadReckon
Extension: Modify/Add commands to the table.
Challenge: Add another piece of data to the state, e.g. LED on/off.
30 |