A
A
Alexander Zaitsev2017-03-14 17:43:54
Arduino
Alexander Zaitsev, 2017-03-14 17:43:54

Why doesn't the arduino output HIGH from the obstacle avoidance sensor?

I use:
- Arduino nano v3 CH340 (taken from here )
- this obstacle avoidance sensor
OUT from the sensor goes to D5 arduins
VCC to 5v
GND to ground
Sketch:

int pin = 8; // d5

void setup() {
  Serial.begin(9600);
  pinMode(pin, INPUT);
}

void loop() {
  int value = digitalRead(pin);
  Serial.println(value);

  delay(1000);
}

If you bring the sensor to your hand, then the LED for the presence of an obstacle lights up on it, but 0 continues to be displayed in the serial window.
Can you tell me what's wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem, 2017-03-14
@nithrous

In this:
You are not reading from pin 5, but from 8.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question