Hi,
I have a grove IR distance interrupter and I can’t get it to change states.
I’m using arduino uno r3.
I tried a couple different tutorials…what am I missing?
(Grove IR Distance Interrupter - Arduino : 3 Steps - Instructables)
Thanks very much for any assistance.
Connections:
VCC to 5V
GND to GND
SIG to terminal 2 (also tried 4 to be sure it wasn’t the terminal)
void setup() {
Serial.begin(9600);
pinMode(2,INPUT);
}
void loop() {
while(1) {
delay(500);
if(digitalRead(2)==LOW) {
Serial.println(“Something in range”);
}
else {
Serial.println(“Nothing in range”);
}
}
}