Go Down

Topic: Infrared Sensor (Read 534 times) previous topic - next topic

Zack_Johnston

Hi everyone!

Is there a code out there for turning on an LED on HIGH for 15 seconds when the Arduino senses infrared light with a TSOP sensor? Thanks!

robtillaart


Sounds like a quite simple program? ONly I don't know hte sensor

Code: [Select]

void setup()
{
  pinMode(10, OUTPUT);
}

void loop()
{
  int x = readSensor();  // to write

  if (x > THRESHOLD)  // fill in real value
  {
    digitalWrite(10,HIGH);
    delay(15);
    digitalWrite(10,LOW);
  }
}


Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Zack_Johnston

Thank you, but with my sensor, it doesn't work.

HazardsMind

Is there a link to where we might find your sensor?
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

Zack_Johnston

It is a TSOP 1736. Here is the data sheet download: http://www.datasheetdir.com/TSOP1736+IrDA


robtillaart

Quote
Thank you, but with my sensor, it doesn't work.

so, you need to add a digitalRead() to read the sensor.


Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Zack_Johnston

Opps...I must be tired :)

Thank you all.

Grumpy_Mike

That sensor will only respond to modulated IR light at 36KHz you know. Also if the light goes on for longer than about 40 pulses it will stop signalling you have IR.
Does that fit in with what you want to do?

Zack_Johnston

Yes...It does fit. Thank you for the information, though!

Go Up