Test for platforms with only analog inputs not outputs.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
melse
Date:
Thu Jul 25 15:32:32 2013 +0000
Commit message:
Initial Commit

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 07a1081e7121 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jul 25 15:32:32 2013 +0000
@@ -0,0 +1,41 @@
+#include "mbed.h"
+
+AnalogOut testAnalog(p18);
+InterruptIn control(p21);
+Serial target (p28,p27);
+Serial pc(USBTX, USBRX);
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+float value = 0;
+
+void goUp() {
+    value += 0.1;
+    testAnalog.write(value);
+    printf("Value: %.2f\r\n", value);
+    
+    if (value >= 1.00f) {
+        value = 0;
+    }
+    
+    while (control.read() == 1);
+}
+
+int main() {
+    target.baud(9600);
+    testAnalog.write(0);
+    control.rise(&goUp);
+    
+    printf("Ready. \r\n");
+    
+    while(1) {
+        if (pc.readable()) {
+            target.putc(pc.getc());
+            led1 = !led1;
+        }
+ 
+        if (target.readable()) {
+            pc.putc(target.getc());
+            led2 = !led2;
+        }
+    }
+}
diff -r 000000000000 -r 07a1081e7121 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jul 25 15:32:32 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17
\ No newline at end of file