Guojun Jiang
/
StewartPlatform
stewartplatform
Fork of PwmOut_HelloWorld by
Revision 3:c5ea5b6a7460, committed 2016-08-20
- Comitter:
- wheels
- Date:
- Sat Aug 20 12:06:14 2016 +0000
- Parent:
- 2:50062ac8646d
- Commit message:
- update
Changed in this revision
--- a/main.cpp Sat May 07 12:27:09 2016 +0000 +++ b/main.cpp Sat Aug 20 12:06:14 2016 +0000 @@ -1,10 +1,10 @@ #include "mbed.h" -//#include "motor.h" +#include "motor.h" #include "usart.h" //#include "file.h" -//extern PwmOut motor[6]; +extern PwmOut motor[6]; extern Serial usart; extern char position[6]; @@ -13,15 +13,15 @@ int main() { int baud = 9600; //baud rate usart_init(baud); //serial port initialize -// motor_init(); + motor_init(); usart.printf("new test!"); while(1) { if (instructionReceived) { instructionReceived = false; usart.printf("0 \n" ); - //usart.printf("pos(%d,%d,%d,%d,%d,%d) \n", position[0], position[1], position[2], position[3], position[4], position[5]); -// motor_drive(); + usart.printf("pos(%d,%d,%d,%d,%d,%d) \n", position[0], position[1], position[2], position[3], position[4], position[5]); + motor_drive(); } } }
--- a/src/motor.cpp Sat May 07 12:27:09 2016 +0000 +++ b/src/motor.cpp Sat Aug 20 12:06:14 2016 +0000 @@ -1,6 +1,6 @@ #include "motor.h" -PwmOut motor[6] = {PwmOut(D8), PwmOut(D9), PwmOut(D10), PwmOut(D11), PwmOut(D12), PwmOut(D13)}; +PwmOut motor[6] = {PwmOut(PA_6), PwmOut(PA_0), PwmOut(PA_2), PwmOut(PB_0), PwmOut(PA_1), PwmOut(PB_9)}; extern char position[6]; void motor_drive() {
--- a/src/usart.cpp Sat May 07 12:27:09 2016 +0000 +++ b/src/usart.cpp Sat Aug 20 12:06:14 2016 +0000 @@ -1,6 +1,6 @@ #include "usart.h" -Serial usart(USBTX, USBRX); +Serial usart(PA_9, PA_10); char positionTemp[7]; char position[6]; @@ -97,7 +97,7 @@ void usart_init(int baud) { - usart.baud(baud); + usart.baud(baud); usart.attach(&usart_ISR); // attach serial interupt service function wait(1); //usart.printf("this is a testing code \n");