удалила лишнее из примеров

This commit is contained in:
klassents committed 2025-01-25 10:33:14 +07:00
1 parent 8a857b5852
commit c081a527fe
13 files changed
+145 -772

No files matched your search

@@ -46,7 +46,6 @@
*/
#include <Arduino.h>
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
/*
* Specify which protocol(s) should be used for decoding.
@@ -72,10 +71,7 @@
//
#if !defined(RAW_BUFFER_LENGTH)
// For air condition remotes it requires 750. Default is 200.
# if !((defined(RAMEND) && RAMEND <= 0x4FF) || (defined(RAMSIZE) && RAMSIZE < 0x4FF))
#define RAW_BUFFER_LENGTH 750
# endif
#endif
//#define EXCLUDE_UNIVERSAL_PROTOCOLS // Saves up to 1000 bytes program memory.
@@ -91,9 +87,20 @@
//#define DEBUG // Activate this for lots of lovely debug output from the decoders.
#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>
int SEND_BUTTON_PIN = APPLICATION_PIN;
int SEND_BUTTON_PIN = BTN_BUILTIN;
int DELAY_BETWEEN_REPEAT = 50;
@@ -113,14 +120,10 @@ void sendCode(storedIRDataStruct *aIRDataToSend);
void setup() {
pinMode(SEND_BUTTON_PIN, INPUT_PULLUP);
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));
@@ -130,7 +133,7 @@ void setup() {
printActiveIRProtocols(&Serial);
Serial.println(F("at pin " STR(IR_RECEIVE_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
Serial.print(F("Ready to send IR signals at pin " STR(IR_SEND_PIN) " on press of button at pin "));
Serial.println(SEND_BUTTON_PIN);
}
@@ -139,6 +142,8 @@ void loop() {
// If button pressed, send the code.
bool tSendButtonIsActive = (digitalRead(SEND_BUTTON_PIN) == LOW); // Button pin is active LOW
if (digitalRead(SEND_BUTTON_PIN))
Serial.println("pressed");
/*
* Check for current button state