Created
January 4, 2023 20:05
-
-
Save zfogg/ad185bad6a1b6dbb1e2da7c8c4b799fa to your computer and use it in GitHub Desktop.
Ellydeez - Infrared Receiver logging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <IRremote.hpp> | |
#define IRRECV_PIN 8 | |
void setup() { | |
// Open a serial connection for printing logs. | |
Serial.begin(9600); | |
// Turn on the infrared receiver. | |
IrReceiver.begin(IRRECV_PIN, ENABLE_LED_FEEDBACK); | |
} | |
void loop() { | |
// If some infrared data was received and can be decoded... | |
if (IrReceiver.decode()) { | |
if (IrReceiver.decodedIRData.decodedRawData != 0) { | |
// Just print it out for debugging. | |
Serial.println(IrReceiver.decodedIRData.decodedRawData); | |
} | |
if (IrReceiver.decodedIRData.decodedRawData == 4077715200) { // Button 1 | |
Serial.println("Button 1 was pressed!"); | |
} else if (IrReceiver.decodedIRData.decodedRawData == 3877175040) { // Button 2 | |
Serial.println("Button 2 was pressed!"); | |
} | |
IrReceiver.resume(); // Continue receiving infrared data... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment