Code Example

/*
  Testing 3 Sharp IR Sensors
  by Brian Patton
  3/25/14
  Feel free to do whatever you want with this code example
 */

int L_SharpValue; // Variable to hold Left Sharp data
int C_SharpValue; // Variable to hold Center Sharp data
int R_SharpValue; // Variable to hold Right Sharp data
const int L_SharpPin = A9; //Pin connecting the sharp
const int C_SharpPin = A8; //Pin connecting the sharp
const int R_SharpPin = A7; //Pin connecting the sharp


void setup() {
// Turn on Serial to display
  Serial.begin(9600); 
}
void loop() {
    L_SharpValue = analogRead(L_SharpPin); //Read the value of the sharp sensor
    C_SharpValue = analogRead(C_SharpPin); //Read the value of the sharp sensor
    R_SharpValue = analogRead(R_SharpPin); //Read the value of the sharp sensor
    Serial.println(" Princeton Sensor Diagnostics Mode ");
    Serial.print("Left Sharp Value = "); 
    Serial.println(L_SharpValue); 
    Serial.print("Center Sharp Value = "); 
    Serial.println(C_SharpValue); 
    Serial.print("Right Sharp Value = "); 
    Serial.println(R_SharpValue); 
    Serial.println(" ");
    delay(1000);

}