Line Follower Hints

Line Follower Hints

Trouble downloading code?
When the 'Download' button is pressed in the bootloader, the message 'searching for bl ....' is displayed for several seconds. To initiate the download, switch the robot on while this message is visible. If the robot is already on, initiate the download by holding and then releasing the reset button, while the 'searching for bl ....' message is visible.

A simple logging technique
The do {} while loop in the demoLineFollower routine is repeated many thousands of times per second. As a result it can be difficult to figure out what reasoning the robot used when it changed direction. However, there is a relatively simple way to log specific events in memory and send them back through the serial port when the robot is re-connected to the computer.

To do this (i)  record the events you are interested in as program variables (ii) create a block in the do{  } while loop that looks for a release of                      the user button (use the button function). This guarantees the data is sent exactly once. (iii) use printf  to send the data to the serial port when the button is released (iv) read the serial port with a terminal program, such as the one provided by the bootloader GUI. Under Linux gtkterm can be used. (set the rate to 19200 in the terminal). This general procedure can be refined in many ways.