this is a sample program being used in KEIHANNA junior robot club

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
RBH
Date:
Sat Oct 08 14:35:53 2016 +0000
Commit message:
beta

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Oct 08 14:35:53 2016 +0000
@@ -0,0 +1,46 @@
+#include "mbed.h"
+
+DigitalOut Ain1(PA_11); // Aモーター1
+DigitalOut Ain2(PC_6);  // Aモーター2
+DigitalOut Bin1(PC_8);  // Bモーター1
+DigitalOut Bin2(PC_9);  // Bモーター2
+DigitalOut sw(D4);      // SW1
+
+void zenshin_A(void);   // Aモーターの前進
+void zenshin_B(void);   // Bモーターの前進
+void koutai_A(void);    // Aモーターの後退
+void koutai_B(void);    // Bモーターの後退
+void brake(void);       // ブレーキ
+
+int main(){
+    
+    while(sw!=1){}      // スイッチを押すとプログラムがスタート
+    
+    zenshin_A();
+    zenshin_B();
+    wait(2);
+    brake();
+}
+
+void zenshin_B(void){
+    Bin1 = 1;
+    Bin2 = 0;
+}
+void zenshin_A(void){
+    Ain1 = 1;
+    Ain2 = 0;
+}
+void koutai_B(void){
+    Bin1 = 0;
+    Bin2 = 1;
+}
+void koutai_A(void){
+    Ain1 = 0;
+    Ain2 = 1;
+}
+void brake(void){
+    Bin1 = 1;
+    Bin2 = 1;
+    Ain1 = 1;
+    Ain2 = 1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Oct 08 14:35:53 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3
\ No newline at end of file