Code Example

int RightVal = 0;           // variable to store the value read
int LeftVal = 0;            // variable to store the value read 
void setup()
{
DDRD = DDRD | B11111100; //Data Direction Register for Port D
DDRB = DDRB | B00000011; //Data Direction Register for Port B
Serial.begin(9600);      // open the serial port at 9600 bps: 
}
 
void loop()
{
      RightVal = analogRead(0);    // read the input pin 0
      LeftVal = analogRead(1);     // read the input pin 1
      Serial.print("Right Signal = "); 
      Serial.println(RightVal);
      Serial.print("Left Signal = ");
      Serial.println(LeftVal);
      Serial.println("");      // prints a carriage return
      
      delay(1000);
}