Guojun Jiang
/
StewartPlatform
stewartplatform
Fork of PwmOut_HelloWorld by
main.cpp@3:c5ea5b6a7460, 2016-08-20 (annotated)
- Committer:
- wheels
- Date:
- Sat Aug 20 12:06:14 2016 +0000
- Revision:
- 3:c5ea5b6a7460
- Parent:
- 2:50062ac8646d
update
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 0:50d2b9c62765 | 1 | #include "mbed.h" |
wheels | 3:c5ea5b6a7460 | 2 | #include "motor.h" |
wheels | 2:50062ac8646d | 3 | #include "usart.h" |
wheels | 2:50062ac8646d | 4 | //#include "file.h" |
wheels | 2:50062ac8646d | 5 | |
mbedAustin | 1:5160ea45399b | 6 | |
wheels | 3:c5ea5b6a7460 | 7 | extern PwmOut motor[6]; |
wheels | 2:50062ac8646d | 8 | extern Serial usart; |
wheels | 2:50062ac8646d | 9 | |
wheels | 2:50062ac8646d | 10 | extern char position[6]; |
wheels | 2:50062ac8646d | 11 | extern bool instructionReceived; |
mbedAustin | 1:5160ea45399b | 12 | |
mbed_official | 0:50d2b9c62765 | 13 | int main() { |
wheels | 2:50062ac8646d | 14 | int baud = 9600; //baud rate |
wheels | 2:50062ac8646d | 15 | usart_init(baud); //serial port initialize |
wheels | 3:c5ea5b6a7460 | 16 | motor_init(); |
wheels | 2:50062ac8646d | 17 | usart.printf("new test!"); |
wheels | 2:50062ac8646d | 18 | |
wheels | 2:50062ac8646d | 19 | while(1) { |
wheels | 2:50062ac8646d | 20 | if (instructionReceived) { |
wheels | 2:50062ac8646d | 21 | instructionReceived = false; |
wheels | 2:50062ac8646d | 22 | usart.printf("0 \n" ); |
wheels | 3:c5ea5b6a7460 | 23 | usart.printf("pos(%d,%d,%d,%d,%d,%d) \n", position[0], position[1], position[2], position[3], position[4], position[5]); |
wheels | 3:c5ea5b6a7460 | 24 | motor_drive(); |
wheels | 2:50062ac8646d | 25 | } |
wheels | 2:50062ac8646d | 26 | } |
wheels | 2:50062ac8646d | 27 | } |