удалила лишнее из примеров
This commit is contained in:
1 parent
2889721109
commit
8a0cc3dded
13 files changed
+145
-772
No files matched your search
@@ -32,11 +32,16 @@
|
||||
*/
|
||||
#include <Arduino.h>
|
||||
|
||||
#if !defined(ARDUINO_ESP32C3_DEV) // This is due to a bug in RISC-V compiler, which requires unused function sections :-(.
|
||||
#define DISABLE_CODE_FOR_RECEIVER // Disables static receiver code like receive timer ISR handler and static IRReceiver and irparams data. Saves 450 bytes program memory and 269 bytes RAM if receiving functions are not required.
|
||||
#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 "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
|
||||
#include <IRremote.hpp>
|
||||
|
||||
#define NUMBER_OF_REPEATS 3U
|
||||
@@ -45,9 +50,6 @@
|
||||
// The second number, here 006C, denotes a frequency code. 006C corresponds to 1000000/(0x006c * 0.241246) = 38381 Hertz.
|
||||
// The third and the forth number denote the number of pairs (= half the number of durations) in the start- and the repeat sequence respectively.
|
||||
const char yamahaVolDown[]
|
||||
#if defined(__AVR__)
|
||||
PROGMEM
|
||||
#endif
|
||||
= "0000 006C 0022 0002 015B 00AD " /* Pronto header + start bit */
|
||||
"0016 0016 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 " /* Lower address byte */
|
||||
"0016 0041 0016 0016 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 " /* Upper address byte (inverted at 8 bit mode) */
|
||||
@@ -58,7 +60,7 @@ PROGMEM
|
||||
IRsend irsend;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
Serial.begin(9600);
|
||||
while (!Serial)
|
||||
; // Wait for Serial to become available. Is optimized away for some cores.
|
||||
|
||||
@@ -66,21 +68,15 @@ void setup() {
|
||||
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
|
||||
Serial.println(F("Send IR signals at pin " STR(IR_SEND_PIN)));
|
||||
|
||||
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
|
||||
IrSender.begin(); // Start with IR_SEND_PIN as send pin and enable feedback LED at default feedback LED pin
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
#if defined(__AVR__)
|
||||
Serial.println(F("Sending NEC from PROGMEM: address 0x85, data 0x1B"));
|
||||
irsend.sendPronto_P(yamahaVolDown, NUMBER_OF_REPEATS);
|
||||
#else
|
||||
Serial.println(F("Sending from normal memory"));
|
||||
irsend.sendPronto(yamahaVolDown, NUMBER_OF_REPEATS);
|
||||
#endif
|
||||
|
||||
delay(2000);
|
||||
Serial.println(F("Sending the NEC from PROGMEM using the F()-form: address 0x5, data 0x1A"));
|
||||
Serial.println(F("Sending the NEC using the F()-form: address 0x5, data 0x1A"));
|
||||
irsend.sendPronto(F("0000 006C 0022 0002 015B 00AD " /* Pronto header + start bit */
|
||||
"0016 0016 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 " /* Lower address byte */
|
||||
"0016 0041 0016 0016 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 " /* Upper address byte (inverted at 8 bit mode) */
|
||||
|
||||
Reference in new issue
Block a user