IR transmit and receive demo using Sparkfun breakout boards See http://mbed.org/users/4180_1/notebook/ir-and-rf-remote-controls/

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
4180_1
Date:
Fri Feb 10 18:02:08 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 e0bef6b1aa57 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Feb 10 18:02:08 2012 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX); // tx, rx
+Serial device(p13, p14);  // tx, rx
+DigitalOut myled1(LED1);
+DigitalOut myled2(LED2);
+PwmOut IRLED(p21);
+//IR send and receive demo
+//LED1 and LED2 indicate TX/RX activity
+//Character typed in PC terminal application sent out and returned back using IR transmitter and receiver
+
+int main() {
+    //IR Transmit code
+    IRLED.period(1.0/38000.0);
+    IRLED = 0.5;
+    //Drive IR LED data pin with 38Khz PWM Carrier
+    //Drive IR LED gnd pin with serial TX
+    device.baud(2400);
+    while(1) {
+        if(pc.readable()) {
+            myled1 = 1;
+            device.putc(pc.getc());
+            myled1 = 0;
+        }
+        //IR Receive code
+        if(device.readable()) {
+            myled2 = 1;
+            pc.putc(device.getc());
+            myled2 = 0;
+        }
+    }
+}
diff -r 000000000000 -r e0bef6b1aa57 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Feb 10 18:02:08 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/14f4805c468c