遥控

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
wanzq
Date:
Wed Oct 25 08:38:02 2017 +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 42bec70dc698 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 25 08:38:02 2017 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+DigitalOut myled1(PA_6);
+DigitalOut myled2(PA_7);
+DigitalIn sz_n(PB_10),sz_p(PA_5),sx_p(PB_0),sx_n(PB_1),sy_p(PB_3),sy_n(PB_4);
+AnalogIn L_Y(PA_0),L_X(PA_1),R_Y(PA_2),R_X(PA_3);
+Serial pc(PA_9,PA_10,9600);
+int main() {
+   while(1) {
+        if(sz_p==0){
+        pc.printf("%f",R_Y.read());}
+        
+        if(sz_n ==0){
+        pc.printf("2");}
+        
+        if(sx_n==0) pc.printf("%F",R_X.read());
+        
+        if(sx_p==0) pc.printf("%f",L_Y.read());
+        
+        if(sy_p==0) pc.printf("%f",L_X.read());
+        
+        if(sy_n==0) pc.printf("6");
+      //  myled1 = 1;
+     //   myled2=1; // LED is ON
+      //  wait(0.2); // 200 ms
+      //  myled2 = 0;
+       // myled1=0; // LED is OFF
+      //  wait(1.0); // 1 sec
+    }
+}
diff -r 000000000000 -r 42bec70dc698 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 25 08:38:02 2017 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/b484a57bc302
\ No newline at end of file