удалила лишнее из примеров
This commit is contained in:
1 parent
2889721109
commit
8a0cc3dded
13 files changed
+145
-772
No files matched your search
@@ -45,21 +45,27 @@
|
||||
|
||||
//#define DEBUG // Activate this for lots of lovely debug output from the decoders.
|
||||
|
||||
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
|
||||
#define IR_RECEIVE_PIN 4
|
||||
#define IR_SEND_PIN 3
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
||||
#include <IRremote.hpp>
|
||||
|
||||
#define DELAY_AFTER_SEND 2000
|
||||
#define DELAY_AFTER_LOOP 5000
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
Serial.begin(9600);
|
||||
while (!Serial)
|
||||
; // Wait for Serial to become available. Is optimized away for some cores.
|
||||
|
||||
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/ \
|
||||
|| defined(SERIALUSB_PID) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_attiny3217)
|
||||
delay(4000); // To be able to connect Serial monitor after reset or power up and before first print out. Do not wait for an attached Serial Monitor!
|
||||
#endif
|
||||
// Just to know which program is running on my Arduino
|
||||
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
|
||||
|
||||
@@ -72,9 +78,7 @@ void setup() {
|
||||
IrSender.begin(); // Start with IR_SEND_PIN -which is defined in PinDefinitionsAndMore.h- as send pin and enable feedback LED at default feedback LED pin
|
||||
Serial.println(F("Send IR signals at pin " STR(IR_SEND_PIN)));
|
||||
|
||||
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604
|
||||
// For esp32 we use PWM generation by ledcWrite() for each pin.
|
||||
# if !defined(SEND_PWM_BY_TIMER) && !defined(USE_NO_SEND_PWM) && !defined(ESP32)
|
||||
# if !defined(SEND_PWM_BY_TIMER) && !defined(USE_NO_SEND_PWM)
|
||||
/*
|
||||
* Print internal software PWM generation info
|
||||
*/
|
||||
@@ -93,7 +97,6 @@ void setup() {
|
||||
Serial.println(F(" us is the (minimum) gap, after which the start of a new IR packet is assumed"));
|
||||
Serial.print(MARK_EXCESS_MICROS);
|
||||
Serial.println(F(" us are subtracted from all marks and added to all spaces for decoding"));
|
||||
#endif
|
||||
}
|
||||
|
||||
uint16_t sAddress = 0x0102;
|
||||
@@ -123,11 +126,7 @@ void receive_ir_data() {
|
||||
Serial.print(F("Decoded protocol: "));
|
||||
Serial.print(getProtocolString(IrReceiver.decodedIRData.protocol));
|
||||
Serial.print(F(", decoded raw data: "));
|
||||
#if (__INT_WIDTH__ < 32)
|
||||
Serial.print(IrReceiver.decodedIRData.decodedRawData, HEX);
|
||||
#else
|
||||
PrintULL::print(&Serial, IrReceiver.decodedIRData.decodedRawData, HEX);
|
||||
#endif
|
||||
Serial.print(F(", decoded address: "));
|
||||
Serial.print(IrReceiver.decodedIRData.address, HEX);
|
||||
Serial.print(F(", decoded command: "));
|
||||
@@ -161,5 +160,5 @@ void loop() {
|
||||
sCommand += 0x11;
|
||||
sRepeats++;
|
||||
|
||||
delay(100); // Loop delay
|
||||
delay(500); // Loop delay
|
||||
}
|
||||
Reference in new issue
Block a user