Cansatモータテスト用です。

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
ponpoko1939
Date:
Fri Aug 10 10:53:13 2018 +0000
Commit message:
Cansat???????

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 b7ec2678555c main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Aug 10 10:53:13 2018 +0000
@@ -0,0 +1,62 @@
+#include "mbed.h"
+
+DigitalOut motor1(p21);
+DigitalOut motor2(p22);
+DigitalOut motor3(p23);
+DigitalOut motor4(p24);
+
+void Brake();
+void Turn();
+void Return();
+void Right();
+void Left();
+
+int main() {
+    while(1) {
+        Turn();
+        wait(3);
+        Return();
+        wait(3);
+        Right();
+        wait(3);
+        Left();
+        wait(3);
+        Breky();
+        wait(3);
+    }
+}
+
+void Breky(){
+    motor1 = 0;
+    motor2 = 0;
+    motor3 = 0;
+    motor4 = 0;    
+}
+
+void Turn(){
+    motor1 = 1;
+    motor2 = 0; 
+    motor3 = 1;
+    motor4 = 0;     
+}
+
+void Return(){
+    motor1 = 0;
+    motor2 = 1;
+    motor3 = 0;
+    motor4 = 1;      
+}
+
+void Left(){
+    motor1 = 1;
+    motor2 = 0;
+    motor3 = 0;
+    motor4 = 1;      
+}
+
+void Right(){
+    motor1 = 0;
+    motor2 = 1;
+    motor3 = 1;
+    motor4 = 0;      
+}
\ No newline at end of file
diff -r 000000000000 -r b7ec2678555c mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Aug 10 10:53:13 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/5aab5a7997ee
\ No newline at end of file