Skip to content

Instantly share code, notes, and snippets.

@faraazahmad
Created April 3, 2019 05:27
Show Gist options
  • Save faraazahmad/3cab440f1e50276e957773f755d64b51 to your computer and use it in GitHub Desktop.
Save faraazahmad/3cab440f1e50276e957773f755d64b51 to your computer and use it in GitHub Desktop.
TSOP
#include <LCD.h>
sbit IR=P1^0;
// intuitive code
void main()
{
LCD_INIT();
while(1) {
if(IR == 0) {
LCD_CMD(LCD_CLEAR);
LCD_WRITE("Detected", 0, 0);
} else {
LCD_CMD(LCD_CLEAR);
LCD_WRITE("Not detected", 0, 0);
}
delay(500);
}
}
// image
// https://i1.wp.com/embetronicx.com/wp-content/uploads/2017/11/ir-sensor-interfacing-with-8051.jpg?resize=768%2C424&ssl=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment