22-01-2021, 19:04
Witam.
Mam oto taki szkic, który ma za zadanie po naciścnieciu przycisku na pilocie, zwrócić jesgo wartość w porcie szeregowym,
Problem w tym, ze jaki przycisk bym nie wcisnął,na porcie szeregowym dostaje 0x0, dzie popełniam błąd?
Mam oto taki szkic, który ma za zadanie po naciścnieciu przycisku na pilocie, zwrócić jesgo wartość w porcie szeregowym,
Kod:
#include <IRremote.h>
//state the IR input to the MCU
#define RECV_PIN 11
//make it recognised to IR Lib
IRrecv irrecv(RECV_PIN);
//ask it it get results and save it
decode_results results;
void setup() {
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop() {
if(irrecv.decode()) {
Serial.print("0x");
Serial.println(results.value,HEX);
delay(250);
irrecv.resume();
}
}