Coding
Coding
In order to control the robot, an Arduino Uno was used as microcontroller. The P-bot was thus programmed in Arduino. The used (and commented) code can be downloaded using following link:
The position to the wire, measured using the coils, will be used in order to determine if the robot is either left or right of the wire. Based on this measurement, the speed of the servomotors used for the wheels will be altered to change the direction of the robot. In case of an object in the way, the robot will react from a certain distance by stopping and blinking its leds.