chris stevens / Mbed 2 deprecated IRtsmp1138demo

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
cstevens
Date:
Thu May 22 11:30:43 2014 +0000
Commit message:
demo code for ir data on tsmp1138 - transmits data across ir link

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 22 11:30:43 2014 +0000
@@ -0,0 +1,34 @@
+#include "mbed.h"
+/*demo program to test ir data transmission using a tsmp1138 ir receiver and an IR LED
+code for an FRDM-KL25Z
+connections are LED negative to the serial TC and the positive to the PWM.
+The output from the tsmp1138 icarries the 38khz modulation and hence requires a smoothing cap to
+allow simple serial detection. 3.3nF between the output and ground from the tsmp1138 is sufficient. 
+*/
+DigitalOut myled(LED2);
+PwmOut carrier(PTA5);
+Serial TX(PTC4,PTC3);
+Serial RX(PTD3,PTD2);
+Serial pc(USBTX,USBRX);
+
+static char message[]="One Fine DAy In the Middle of the Night\n";
+
+int main() {
+    char c;
+    pc.printf("start\n\r");
+    int n;
+    //set up the twp ports
+    RX.baud(1000);
+    TX.baud(1000);
+    carrier.period(1.0/38000.0);
+    carrier=0.5;
+    n=0;
+    while(1) {
+        TX.putc(message[n]);
+        n=(n+1)%sizeof(message);
+        wait(0.05);
+        myled=!myled;
+        c=RX.getc();
+        pc.putc(c);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu May 22 11:30:43 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/0b3ab51c8877
\ No newline at end of file