/* by Brian Patton 3/04/15 Feel free to do whatever you want with this code example */int L_PhotoValue; // Variable to hold Left Sharp dataint R_PhotoValue; // Variable to hold Right Sharp dataconstint L_PhotoPin = A2; //Pin connecting the Voltage Divider Boardconstint R_PhotoPin = A1; //Pin connecting the Voltage Divider Boardvoidsetup() {
Serial.begin(9600);
}
voidloop() {
L_PhotoValue = analogRead(L_PhotoPin); //Read the value of the sharp sensor
R_PhotoValue = analogRead(R_PhotoPin); //Read the value of the sharp sensorfor(int i = 0; i < L_PhotoValue/10; i++) // Move over Photovalue/10 blank spaces
{
Serial.print(" "); //blank spaces
}
Serial.println("L"); //place a L at the end of the blank spacesfor(int i = 0; i < R_PhotoValue/10; i++) // Move over Photovalue/10 blank spaces
{
Serial.print(" "); //Blank Spaces
}
Serial.println("R");// Place an R at the end of the linedelay(5);
}