Skip to content

Instantly share code, notes, and snippets.

@JeremySCook
Created May 12, 2020 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeremySCook/63ab051335b8d206a5f6cde27c942a07 to your computer and use it in GitHub Desktop.
Save JeremySCook/63ab051335b8d206a5f6cde27c942a07 to your computer and use it in GitHub Desktop.
infrared with light
/*
* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
* modified for light indicator JSCook 5/12/2020
*/
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
// In case the interrupt driver crashes on setup, give a clue
// to the user what's going on.
Serial.println("Enabling IRin");
irrecv.enableIRIn(); // Start the receiver
Serial.println("Enabled IRin");
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
if (irrecv.decode(&results)) {
digitalWrite(LED_BUILTIN, HIGH);
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}
delay(100);
digitalWrite(LED_BUILTIN, LOW);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment