ADC DAC Delay and Serial Comm demo program rev1

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
kklokeshkumar
Date:
Wed Nov 12 10:21:13 2014 +0000
Commit message:
ADC DAC and serial com rev1

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 0571a4f49d00 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Nov 12 10:21:13 2014 +0000
@@ -0,0 +1,46 @@
+#include "mbed.h"
+ 
+Serial pc(USBTX, USBRX);
+AnalogOut signal(PTE30);
+ DigitalOut myled(LED2);
+ DigitalIn sw1(PTB0);
+DigitalIn sw2(PTB1);
+
+int main() 
+{
+    char ot =0;
+    signal = 0;
+    char inp;
+float seconds;
+    pc.printf("Enter the seconds\n");
+        pc.putc(inp = pc.getc());
+        //pc.printf("\n seconds entered was %c \n",inp);
+                seconds = (float) (inp-48);
+                 pc.printf("\n seconds entered was %f \n",seconds);
+                 myled = 1;
+   while(1) {
+       
+       if (!sw1 && sw2)
+       {
+            myled = 0;
+            wait(seconds);
+           signal = 0.122;
+             myled = 1;
+        }
+        if (!sw2)
+        {
+           //myled = 1;
+             signal = 0;
+              // myled = 0;
+        }
+       /*for(int i=3000; i<10000; i++) 
+        {
+            signal.write_u16(i);
+            pc.printf(" %d ",i);
+            ot = ~ot;
+            myled = ot;
+            wait(0.01);
+        }*/
+    }
+    //signal = 1;
+}
diff -r 000000000000 -r 0571a4f49d00 mbed.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.lib	Wed Nov 12 10:21:13 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/#031413cf7a89