Adam Forster / Matt Polly


This is a car that has light sensors on it and drives itself by finding light and driving towards it. When it is in the light it goes strait, and it will automatically turn back into light when going into a shadow. All you do is plug in the 9-volt battery so the wheels have turning power, and turn on the switch at the bottom of the car, which makes the back wheels turn on so the car will move.


Some problems we encountered were that we had the wrong code, and it took many different tries to fix it and finally create the correct code. Another problem we encountered was trying to figure out the light sensitivity. It was too sensitive at first and then we made it so it wouldn't turn at all, and then we figured it out.

Further Building

If we had more time, we would have put a bumper on the front, so if it hit a wall, it would back up on its own and redirect itself so it would turn around and continue on its way all by itself without us needing to pick it up and turn it around.

#include <Servo.h> Servo myservo; // create servo object to control a servo int potPin1 = 2; // select the input pin for the potentiometerint potPin2 = 3; // select the input pin for the potentiometerint val = 0; // variable to store the value coming from the sensorint val1 = 0; int servoPin = 11; //Connects the yellow wire to pin 11int myAngle; //This sets the variable for your servo anglevoid setup () { myservo.attach(servoPin); // attaches the servo on pin 11 to the servo object } void loop() { val = analogRead(potPin1); val1 = analogRead(potPin2); if (val > val1*1.3) // if "val" is greater than "val1" then the { myAngle=45; // servo motor will adjust to the desired angle } else if (val1 > val*1.3) // if "val1" is greater than "val" then the { myAngle=135; // servo motor will adjust to the desired angle } else { myAngle=90; // if niether value is registered, then the servo remains stationary } myservo.write(myAngle); // sets the servo to correct angle }