Code Example

/*
  Testing 5 Analog ;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
int L_VDBValue; // Variable to hold Left VDB data
int R_VDBValue; // Variable to hold Right VDB 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
const int L_VDBPin = A6; //Pin connecting the Left Voltage Divider Board
const int R_VDBPin = A5; //Pin connecting the Right Voltage Divider Board

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
    L_VDBValue = analogRead(L_VDBPin); //Read the value of the VDB sensor
    R_VDBValue = analogRead(R_VDBPin); //Read the value of the VDB 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.print("Left VDB Value = "); 
    Serial.println(L_VDBValue); 
    Serial.print("Right VDB Value = "); 
    Serial.println(R_VDBValue);
    Serial.println(" ");
    delay(1000);

}