Stuck on top is a old battery pack and a breadboard with the Arduino and the L293D Motordriver.
Also a GP2Y0A02YK Distance sensor sits on the plywood, professionaly mounted with too big screws
Code
As simple as the Robot is the Code.
It watches if something gets to close, and then turns until it finds no obstacle. Then it moves until something gets to close, and so on...
Arduino code:
// constants won't change. They're used here to // set pin numbers: const int buttonPin = 2; // the number of the pushbutton pin const int ledPin = 13; // the number of the LED pin
const int M1pwm = 9; const int M1a = 4; const int M1b = 7;
const int M2pwm = 10; const int M2a = 8; const int M2b = 12;
int Dist = 0;
// variables will change: int buttonState = 0; // variable for reading the pushbutton status