удалила лишнее, протестировала
This commit is contained in:
1 parent
d9946ff386
commit
3b26203ebb
10 files changed
+87
-277
No files matched your search
+16
-8
@@ -63,20 +63,30 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
|
||||
//#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
|
||||
#include <IRremote.hpp>
|
||||
|
||||
/*
|
||||
* Helper macro for getting a macro definition as string
|
||||
*/
|
||||
#if !defined(STR_HELPER)
|
||||
#define STR_HELPER(x) #x
|
||||
#define STR(x) STR_HELPER(x)
|
||||
#endif
|
||||
|
||||
#define IR_RECEIVE_PIN 2
|
||||
|
||||
/*
|
||||
* For callback
|
||||
*/
|
||||
#define PROCESS_IR_RESULT_IN_MAIN_LOOP
|
||||
#if defined(PROCESS_IR_RESULT_IN_MAIN_LOOP) || defined(ARDUINO_ARCH_MBED) || defined(ESP32)
|
||||
// #define PROCESS_IR_RESULT_IN_MAIN_LOOP
|
||||
// #if defined(PROCESS_IR_RESULT_IN_MAIN_LOOP) || defined(ARDUINO_ARCH_MBED) || defined(ESP32)
|
||||
volatile bool sIRDataJustReceived = false;
|
||||
#endif
|
||||
// #endif
|
||||
void ReceiveCompleteCallbackHandler();
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
Serial.begin(9600);
|
||||
while (!Serial)
|
||||
; // Wait for Serial to become available. Is optimized away for some cores.
|
||||
|
||||
@@ -111,6 +121,7 @@ void loop() {
|
||||
IrReceiver.printIRSendUsage(&Serial);
|
||||
}
|
||||
Serial.println();
|
||||
sIRDataJustReceived = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,9 +134,6 @@ void loop() {
|
||||
* In order to enable other interrupts you can call sei() (enable interrupt again) after evaluating/copying data.
|
||||
* Good practice, but somewhat more complex, is to copy relevant data and signal receiving to main loop.
|
||||
*/
|
||||
#if defined(ESP32) || defined(ESP8266)
|
||||
IRAM_ATTR
|
||||
# endif
|
||||
void ReceiveCompleteCallbackHandler() {
|
||||
IrReceiver.decode(); // fill IrReceiver.decodedIRData
|
||||
/*
|
||||
|
||||
Reference in new issue
Block a user