изменена инициализация кнопки

This commit is contained in:
KLASSENTS 2025-01-24 11:00:12 +07:00
parent c081a527fe
commit 915386cf99
2 changed files with 4 additions and 6 deletions

View File

@ -101,6 +101,7 @@
#include <IRremote.hpp>
int SEND_BUTTON_PIN = BTN_BUILTIN;
int BTN_ACTIVE_STATE = HIGH;
int DELAY_BETWEEN_REPEAT = 50;
@ -118,7 +119,7 @@ void storeCode();
void sendCode(storedIRDataStruct *aIRDataToSend);
void setup() {
pinMode(SEND_BUTTON_PIN, INPUT_PULLUP);
pinMode(SEND_BUTTON_PIN, INPUT);
Serial.begin(9600);
while (!Serial)
@ -141,10 +142,7 @@ void setup() {
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");
bool tSendButtonIsActive = (digitalRead(SEND_BUTTON_PIN) == BTN_ACTIVE_STATE); // Button pin is active LOW
/*
* Check for current button state
*/

View File

@ -93,7 +93,7 @@ uint8_t sNumberOfBits = 32;
bool sSendButtonWasActive;
void setup() {
pinMode(SEND_BUTTON_PIN, INPUT_PULLUP);
pinMode(SEND_BUTTON_PIN, INPUT);
Serial.begin(9600);
while (!Serial)