Code that reads IR signals to create a PC remote for mBED.

Dependencies:   mbed

main.cpp

Committer:
jlogreira3
Date:
2016-04-28
Revision:
0:a2ae3dcce8c4

File content as of revision 0:a2ae3dcce8c4:

#include "mbed.h"

Serial receiver(p28, p27); // tx, rx
Serial pc(USBTX, USBRX); // tx, rx
DigitalOut myled1(LED1);
DigitalOut myled2(LED2);

int main()
{
    receiver.baud(2400);
    pc.baud(2400);
    while(1)
    {
        if(pc.readable())
        {
            myled1 = 1;
            receiver.putc(pc.getc());
            myled1 = 0;
        }
        if(receiver.readable())
        {
            myled2 = 1;
            pc.printf("%x ", receiver.getc());
            myled2 = 0;
        }
    }
}