aaa

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
turnip
Date:
Sat Jun 01 03:06:00 2019 +0000
Commit message:
a

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 9aec4ef78a5a main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Jun 01 03:06:00 2019 +0000
@@ -0,0 +1,107 @@
+#include "mbed.h"
+/*
+DigitalIn l1(PA_7,PullUp);
+DigitalIn l2(PA_6,PullUp);
+DigitalIn r1(PF_1,PullUp);
+DigitalIn r2(PA_0,PullUp);
+DigitalIn s1(PA_4,PullUp);
+DigitalIn s2(PA_1,PullUp);
+DigitalIn horyuu(PA_3,PullUp);
+*/
+
+PwmOut left1(PA_12);
+PwmOut left2(PB_0);
+PwmOut right1(PA_8);
+PwmOut right2(PF_0);
+/*
+PwmOut servo1(PA_11);
+PwmOut servo2(PB_5);
+*/
+float max=0.7;
+
+int main()
+{
+    while(1) {
+
+        right1=0.6;
+        right2=0;
+        left1=0.6;
+        left2=0;
+    
+        /*if(l1.read()==0){
+            wait(0.05);
+            if(l1.read()==0){
+            left1=max;
+            left2=0;
+            }
+        }
+        if(l2.read()==0){
+            wait(0.05);
+            if(l2.read()==0){
+            left1=0;
+            left2=max;
+            }
+        }
+        if(r1.read()==0){
+            wait(0.05);
+            if(r1.read()==0){
+            right1=max;
+            right2=0;
+            }
+        }
+        if(r2.read()==0){
+            wait(0.05);
+            if(r2.read()==0){
+            right1=0;
+            right2=max;
+            }
+        }
+
+        int count1=0;
+        int old1=1;
+        int now1=1;
+
+        if(s1.read()==0){
+            old1=now1;
+            now1=s1.read();
+            if(now1 == 0 && old1 == 1) {
+                wait(0.05);
+                now1 = s1.read();
+                if(now1 == 0){
+                    count1++;
+                    }
+            }
+            if(count1 == 1){
+                    servo1.pulsewidth_us(500);
+                }else{
+                    servo1.pulsewidth_us(2400);
+                    count1=0;
+                    }
+         }
+
+         int count2=0;
+         int old2=1;
+         int now2=1;
+
+        if(s2.read()==0){
+            old2=now2;
+            now2=s2.read();
+            if(now2 == 0 && old2 == 1) {
+                wait(0.05);
+                now2 = s2.read();
+                if(now2 == 0){
+                    count2++;
+                    }
+                }
+                if(count2 == 1){
+                        servo2.pulsewidth_us(500);
+                    }else{
+                        servo2.pulsewidth_us(2400);
+                        count2=0;
+                        }
+                }
+
+            printf("motor=%f,%f,%f,%f\r\n",left1.read(),left2.read(),right1.read(),right2.read());
+        */
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 9aec4ef78a5a mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Jun 01 03:06:00 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file