volatile char *ddrD = 0x2A; // Port D Data Direction Register
volatile char *outD = 0x2B; // Port D Data Register
volatile char *inD = 0x29; // Port D Input Pins Addres
void setup() {
*ddrD =0x08; // set pin 3 for output
*inD = 0x00; //set the other pas ins as input
}
void loop() {
volatile char input;
input = *inD;
if(input & 0X04 )
{
*outD = 0x08; //turn on the led when the sensor detects.
}
else
*outD = 0x00;//turn the led when the sensor does not detects.
}