изменена инициализация кнопки
This commit is contained in:
parent
8a0cc3dded
commit
aaa96bd13b
@ -101,6 +101,7 @@
|
|||||||
#include <IRremote.hpp>
|
#include <IRremote.hpp>
|
||||||
|
|
||||||
int SEND_BUTTON_PIN = BTN_BUILTIN;
|
int SEND_BUTTON_PIN = BTN_BUILTIN;
|
||||||
|
int BTN_ACTIVE_STATE = HIGH;
|
||||||
|
|
||||||
int DELAY_BETWEEN_REPEAT = 50;
|
int DELAY_BETWEEN_REPEAT = 50;
|
||||||
|
|
||||||
@ -118,7 +119,7 @@ void storeCode();
|
|||||||
void sendCode(storedIRDataStruct *aIRDataToSend);
|
void sendCode(storedIRDataStruct *aIRDataToSend);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
pinMode(SEND_BUTTON_PIN, INPUT_PULLUP);
|
pinMode(SEND_BUTTON_PIN, INPUT);
|
||||||
|
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
while (!Serial)
|
while (!Serial)
|
||||||
@ -141,10 +142,7 @@ void setup() {
|
|||||||
void loop() {
|
void loop() {
|
||||||
|
|
||||||
// If button pressed, send the code.
|
// If button pressed, send the code.
|
||||||
bool tSendButtonIsActive = (digitalRead(SEND_BUTTON_PIN) == LOW); // Button pin is active LOW
|
bool tSendButtonIsActive = (digitalRead(SEND_BUTTON_PIN) == BTN_ACTIVE_STATE); // Button pin is active LOW
|
||||||
if (digitalRead(SEND_BUTTON_PIN))
|
|
||||||
Serial.println("pressed");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for current button state
|
* Check for current button state
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -93,7 +93,7 @@ uint8_t sNumberOfBits = 32;
|
|||||||
bool sSendButtonWasActive;
|
bool sSendButtonWasActive;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
pinMode(SEND_BUTTON_PIN, INPUT_PULLUP);
|
pinMode(SEND_BUTTON_PIN, INPUT);
|
||||||
|
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
while (!Serial)
|
while (!Serial)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user