jump!

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
OGA
Date:
Mon Aug 26 06:26:08 2013 +0000
Commit message:
jump!

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 60e106288ab5 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Aug 26 06:26:08 2013 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+
+DigitalIn sw(p5);
+DigitalOut myled[4] = {LED1,LED2,LED3,LED4};
+DigitalOut air[2]={p19,p20};
+AnalogIn ain(p18);
+
+int main() {
+    sw.mode(PullUp);
+    unsigned short adVal = 0;
+    air[0] = 0; air[1] = 0;
+    while(1) {
+        adVal = ain.read_u16() >> 4;
+        /*if(sw == 0){
+            air[0] = 1;  air[1] = 0;  myled[0] = 1;
+            wait(0.4);
+            air[0] = 0;  air[1] = 1;  myled[0] = 0;
+        }*/
+        if(adVal > 1500){
+            air[0] = 1;  air[1] = 0;  myled[0] = 1;
+            wait(0.4);
+            air[0] = 0;  air[1] = 1;  myled[0] = 0;
+            wait(1);
+        }
+        printf("%d\n", adVal);
+        wait(0.05);
+    }
+}
diff -r 000000000000 -r 60e106288ab5 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Aug 26 06:26:08 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17
\ No newline at end of file