Armando Casalino
/
IR_remote
A test script for testing a generic IR remote on STM32 NUCLEO
main.cpp
- Committer:
- havebug
- Date:
- 2017-07-13
- Revision:
- 1:5e7be7addf96
- Parent:
- 0:42764550a2cb
- Child:
- 2:35f80e65a141
File content as of revision 1:5e7be7addf96:
#include "mbed.h" #include "ReceiverIR.h" ReceiverIR ir_rx(D2); Serial pc(SERIAL_TX, SERIAL_RX); DigitalOut myled(LED1); RemoteIR::Format format; uint8_t buf[32]; int bitcount; int main() { pc.printf("Hello World !\r\n"); while(1) { if (ir_rx.getState() == ReceiverIR::Received) { bitcount = ir_rx.getData(&format, buf, sizeof(buf) * 8); if (bitcount>0){ pc.printf("Decoded: %02X \r\n", buf[3]); myled = !myled; /* DEBUG for (int i = 0; i < bitcount; i++) { pc.printf("%02X", buf[i]); } */ } } } }