単輪試験機用モータドライバテスト

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
manimani3712
Date:
Tue Jan 12 07:48:50 2016 +0000
Commit message:
??????????_test

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 f577792e4c6c main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jan 12 07:48:50 2016 +0000
@@ -0,0 +1,56 @@
+//motor_test
+
+#include "mbed.h"
+
+DigitalOut rled(LED_RED);
+DigitalOut gled(LED_GREEN);
+DigitalOut bled(LED_BLUE);
+Serial pc(USBTX, USBRX);
+PwmOut motor(PTC9);
+
+int s;
+BusOut motor1(PTA13,PTD5);
+
+void drivecommand () {
+    s = pc.getc();
+    pc.printf("%c",s);
+    if(s=='1'){
+        motor1 = 3;
+        float pwidth;
+        motor.period_ms(10);
+        motor.pulsewidth(pwidth);
+        pc.printf("slow\n");
+        
+        motor1 = 1;
+        
+        }
+    else if(s=='2'){
+        motor1 = 3;
+        float pwidth;
+        motor.period_ms(20);
+        motor.pulsewidth(pwidth);
+        pc.printf("normal\n");
+        motor1 = 2;
+        
+        }
+    else if(s=='3'){
+        motor1 = 3;
+        float pwidth;
+        motor.period_ms(30);
+        motor.pulsewidth(pwidth);
+        pc.printf("fast\n");
+        motor1 = 1;
+        
+        }
+    else if(s=='5'){
+        pc.printf("stop\n");
+        motor1 = 3;
+        }
+    }
+int main() {
+    pc.attach(drivecommand, Serial::RxIrq);
+     pc.printf("HELLO WORLD\n");
+    while(1) {
+     
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r f577792e4c6c mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Jan 12 07:48:50 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4336505e4b1c
\ No newline at end of file