Go Down

Topic: Adjustable Infrared Sensor Switch (SKU:SEN0019) (Read 1 time) previous topic - next topic

maxmax39

Hi,
who did use this sensor
How we could tune it.  I try to read input.  But never goes to high

Thx
Max

juycce

did u tried this?
Code: [Select]

const int InfraredSensorPin = 4;//Connect the signal pin to the digital pin 4 >> yellow
const int LedDisp = 13;

void setup()
{
  Serial.begin(57600);
  Serial.println("Start!"); 
  pinMode(InfraredSensorPin,INPUT);
  pinMode(LedDisp,OUTPUT);
  digitalWrite(LedDisp,LOW);
}

void loop()
{
  if(digitalRead(InfraredSensorPin) == LOW)  digitalWrite(LedDisp,HIGH);
  else  digitalWrite(LedDisp,LOW);
  Serial.print("Infrared Switch Status:");
  Serial.println(digitalRead(InfraredSensorPin),BIN);
  delay(50);
}





    Red - V+
    Yellow - Signal
    Green - GND
    detection range is 3cm - 80cm

maxmax39


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy