A smart remote using the sparkfun IR transmitter and receiver. The program also uses a web server to show the buttons on a mobile platform.
Dependencies: EthernetInterface HTTPServer RemoteIR SDFileSystem mbed-rpc mbed-rtos mbed
Fork of SmartRemoteClean by
Revision 6:70a0af38edcc, committed 2013-12-03
- Comitter:
- sammacjunkie
- Date:
- Tue Dec 03 03:49:12 2013 +0000
- Parent:
- 5:6a8acf950116
- Child:
- 7:7b3f53b5e737
- Child:
- 10:da52ff0b93c0
- Commit message:
- updated
Changed in this revision
IR.cpp | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/IR.cpp Tue Dec 03 02:41:56 2013 +0000 +++ b/IR.cpp Tue Dec 03 03:49:12 2013 +0000 @@ -51,7 +51,7 @@ */ void display_status(char *status, int bitlength) { - printf("%-5.5s:%02d", status, bitlength); + printf("%-5.5s:%02d \n \r", status, bitlength); } /** @@ -94,6 +94,7 @@ printf("%02X", buf[i]); } for (int i = 0; i < 8 - n; i++) { - printf("--"); + printf("--\n \r"); } + } \ No newline at end of file
--- a/main.cpp Tue Dec 03 02:41:56 2013 +0000 +++ b/main.cpp Tue Dec 03 03:49:12 2013 +0000 @@ -5,6 +5,8 @@ #include "RpcHandler.h" #include "rtos.h" +DigitalOut led1(LED1); + //Start IR #include "ReceiverIR.h" #include "TransmitterIR.h" @@ -100,6 +102,22 @@ if(tm.read()>.5) { tm.start(); } + if (Learn) { + led1 = 1; + { + bitlength1 = receive(&format, buf1, sizeof(buf1)); + if (bitlength1 < 0) { + continue; + } + display_status("RECV", bitlength1); + display_data(buf1, bitlength1); + //display_format(format); + } + printf("%d",buf1); + led1 = 0; + Learn = 0; + } + } return 0;