infrared remote
This commit is contained in:
parent
a09710fa4b
commit
e984ffa46b
@ -4,6 +4,7 @@ board = esp32dev
|
|||||||
framework = arduino
|
framework = arduino
|
||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
lib_deps = https://github.com/adafruit/Adafruit_NeoPixel
|
lib_deps = https://github.com/adafruit/Adafruit_NeoPixel
|
||||||
|
https://github.com/Arduino-IRremote/Arduino-IRremote
|
||||||
upload_port = /dev/ttyUSB0
|
upload_port = /dev/ttyUSB0
|
||||||
upload_speed = 460800
|
upload_speed = 460800
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
|||||||
@ -3,15 +3,17 @@
|
|||||||
#include "buzzer.h"
|
#include "buzzer.h"
|
||||||
#include "countdown.h"
|
#include "countdown.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
#include "remote.h"
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
delay(500);
|
delay(500);
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
Serial.println("\n\n\nstartup");
|
Serial.println("\n\n\nStartup");
|
||||||
|
|
||||||
beeperSetup();
|
beeperSetup();
|
||||||
buttonSetup();
|
buttonSetup();
|
||||||
buzzerSetup();
|
buzzerSetup();
|
||||||
|
remoteSetup();
|
||||||
|
|
||||||
displaySetup();
|
displaySetup();
|
||||||
|
|
||||||
@ -21,5 +23,6 @@ void setup() {
|
|||||||
void loop() {
|
void loop() {
|
||||||
beeperLoop();
|
beeperLoop();
|
||||||
buttonLoop();
|
buttonLoop();
|
||||||
|
remoteLoop();
|
||||||
countdownLoop();
|
countdownLoop();
|
||||||
}
|
}
|
||||||
|
|||||||
30
src/remote.cpp
Normal file
30
src/remote.cpp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#include "remote.h"
|
||||||
|
|
||||||
|
#include <IRremote.hpp>
|
||||||
|
|
||||||
|
void remoteSetup() {
|
||||||
|
IrReceiver.begin(21);
|
||||||
|
}
|
||||||
|
|
||||||
|
void remoteLoop() {
|
||||||
|
if (IrReceiver.decode()) {
|
||||||
|
Serial.println("--------------------------------------------------------------");
|
||||||
|
IrReceiver.printIRResultShort(&Serial);
|
||||||
|
if (IrReceiver.decodedIRData.flags & IRDATA_FLAGS_WAS_OVERFLOW) {
|
||||||
|
Serial.println("OVERFLOW");
|
||||||
|
} else {
|
||||||
|
Serial.println(getProtocolString(IrReceiver.decodedIRData.protocol));
|
||||||
|
IrReceiver.printIRSendUsage(&Serial);
|
||||||
|
IrReceiver.printIRResultRawFormatted(&Serial, false);
|
||||||
|
IrReceiver.printIRResultRawFormatted(&Serial, true);
|
||||||
|
IrReceiver.compensateAndPrintIRResultAsCArray(&Serial, false);
|
||||||
|
IrReceiver.compensateAndPrintIRResultAsCArray(&Serial, true);
|
||||||
|
IrReceiver.printIRResultAsCVariables(&Serial);
|
||||||
|
IrReceiver.compensateAndPrintIRResultAsPronto(&Serial);
|
||||||
|
}
|
||||||
|
IrReceiver.resume();
|
||||||
|
Serial.println("--------------------------------------------------------------");
|
||||||
|
Serial.println();
|
||||||
|
Serial.println();
|
||||||
|
}
|
||||||
|
}
|
||||||
8
src/remote.h
Normal file
8
src/remote.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef REMOTE_H
|
||||||
|
#define REMOTE_H
|
||||||
|
|
||||||
|
void remoteSetup();
|
||||||
|
|
||||||
|
void remoteLoop();
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue
Block a user