![](/media/cache/profiles/ibmfp2.jpg.50x50_q85.jpg)
RF link test program using low cost modules from Sparkfun See http://mbed.org/users/4180_1/notebook/ir-and-rf-remote-controls/
Revision 0:a4f7b521f1ce, committed 2012-02-10
- Comitter:
- 4180_1
- Date:
- Fri Feb 10 02:33:58 2012 +0000
- Commit message:
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r a4f7b521f1ce main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Feb 10 02:33:58 2012 +0000 @@ -0,0 +1,35 @@ +#include "mbed.h" + +Serial pc(USBTX, USBRX); // tx, rx +Serial device(p9, p10); // tx, rx +DigitalOut myled1(LED1); +DigitalOut myled2(LED2); +//RF link demo using low-cost Sparkfun RF transmitter and receiver modules +//LEDs indicate link activity +//Characters typed in PC terminal windows will echo back using RF link +int main() { + char temp=0; + device.baud(2400); + while (1) { + + //RF Transmit Code + if (pc.readable()==0) { + myled1 = 1; + //Send 10101010 pattern when idle to keep receiver in sync and locked to transmitter + //When receiver loses the sync lock (Around 30MS with no data change seen) it starts sending out noise + device.putc(0xAA); + myled1 = 0; + } else + //Send out the real data whenever a key is typed + device.putc(pc.getc()); + + //RF Receive Code + if (device.readable()) { + myled2 = 1; + temp=device.getc(); + //Ignore Sync pattern and do not pass on to PC + if (temp!=0xAA) pc.putc(temp); + myled2 = 0; + } + } +}
diff -r 000000000000 -r a4f7b521f1ce mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Feb 10 02:33:58 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/14f4805c468c