Bolly and My Kids

by robertodelle in Circuits > Robots

821 Views, 19 Favorites, 0 Comments

Bolly and My Kids

20141227_190642.jpg
Bolly an my kids
20141219_195158.jpg
20141219_195146.jpg
20141219_200905.jpg
20141219_200932.jpg
20141219_213121.jpg
20141219_213129.jpg
20141219_212957.jpg
20141219_212941.jpg

This is my first robot project with arduino and I it is based on this instructable:Basic Arduino Robot, Light Seeker!

The my surprise of this project is the interaction between a simple robot and my seven years old kids and the great interesting in my nine years old daughter.

Circuit Diagram and Code

20141227_191020.jpg
20141227_192134.jpg
lightseeker.jpg

CODE:

const int RightMotor = 12;
const int LeftMotor = 11;

const int RightSensor = 1;

const int LeftSensor = 2;

int SensorLeft;

int SensorRight;

int SensorDifference;

void setup() {

pinMode(LeftMotor, OUTPUT);

pinMode(RightMotor, OUTPUT);

pinMode(LeftSensor, INPUT);

pinMode(RightSensor, INPUT);

digitalWrite(A1, HIGH);

digitalWrite(A2, HIGH);

Serial.begin(9600);

Serial.println(" \nBeginning Light Seeking Behavior");

}

void loop() {

SensorLeft = 1023 - analogRead(LeftSensor);

delay(1);

SensorRight = 1023 - analogRead(RightSensor);

delay(1);

SensorDifference = abs(SensorLeft - SensorRight);

if (SensorLeft > 500 && SensorRight > 500){

if (SensorLeft > SensorRight && SensorDifference > 75) {

digitalWrite(RightMotor, HIGH);

digitalWrite(LeftMotor, LOW);

}

if (SensorLeft < SensorRight && SensorDifference > 75) {

digitalWrite(RightMotor, LOW);

digitalWrite(LeftMotor, HIGH);

}

if (SensorDifference < 75) {

digitalWrite(RightMotor, HIGH);

digitalWrite(LeftMotor, HIGH);

}

}

if (SensorLeft < 500 && SensorRight < 500){

if (SensorLeft > SensorRight && SensorDifference > 75) {

digitalWrite(RightMotor, LOW);

digitalWrite(LeftMotor, LOW);

}

}

}

Photos

20141227_192103.jpg
20141227_191147.jpg
20141227_191009.jpg
20141227_191000.jpg
20141227_191032.jpg
20141227_191136.jpg
20141227_191041.jpg
20141227_191118.jpg
20141227_191214.jpg
20141227_191154.jpg
20141227_191207.jpg
20141227_191221.jpg
20141227_191246.jpg
20141227_191307.jpg
20141227_191321.jpg
20141227_192139.jpg
20141227_191327.jpg
20141227_191540.jpg
20141227_191345.jpg
20141227_191359.jpg
20141227_191546.jpg
20141227_191553.jpg
20141227_191610.jpg
20141227_191618.jpg
20141227_191630.jpg
20141227_191649.jpg
20141227_191702.jpg
20141227_191758.jpg
20141227_191725.jpg
20141227_191728.jpg
20141227_191811.jpg
20141227_191820.jpg
20141227_191827.jpg
20141227_191924.jpg
20141227_191836.jpg
20141227_192039.jpg
20141227_191907.jpg
20141227_192115.jpg
20141227_191945.jpg
20141227_190712.jpg