Go Down

Topic: Adjustable Infrared Sensor Switch (SKU:SEN0019) (Read 898 times) 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