Hey,
i have an avoidance sensor, that is working correctly. How you would expect:
Move sth near the sensor and the led of it will light. You can change the sensitivity by
turning the potentiometer of it.
Then i bought myself 3 more avoidance sensor. But these arent working as expected.
The led should keep lighting as sth is towards the sensor. But at most it will blink for once and
only if the object moved fast towards the sensor. Ive already adjusted the two potentiometers
of it but i cant make it work correctly.
Here is a photo of the arduino with sensor.
I bought the sensors here:
And the code:
int isObstacle = HIGH;
int input = 3;
void setup() {
// put your setup code here, to run once:
pinMode(LED_BUILTIN,OUTPUT);
pinMode(input,INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
isObstacle = digitalRead(input);
if(isObstacle == HIGH)
{
Serial.println("Nichts!");
digitalWrite(LED_BUILTIN,LOW);
}
else
{
Serial.println("Signal!");
digitalWrite(LED_BUILTIN,HIGH);
}
delay(200);
}
Hope someone can help me.