![](/media/cache/group/11700697_10200701668420946_8214886085951071495_o.jpg.50x50_q85.jpg)
ใช้้สื่อสารระหว่างบอร์ด Brain และ Motion
Dependencies: BEAR_Protocol iSerial mbed
main.cpp@1:65ef1fe8e2f8, 2016-01-15 (annotated)
- Committer:
- b0ssiz
- Date:
- Fri Jan 15 15:55:13 2016 +0000
- Revision:
- 1:65ef1fe8e2f8
- Parent:
- 0:db3b9f12e4d5
Update Floating point;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
b0ssiz | 0:db3b9f12e4d5 | 1 | #include "mbed.h" |
b0ssiz | 0:db3b9f12e4d5 | 2 | #include "BEAR_Protocol.h" |
b0ssiz | 1:65ef1fe8e2f8 | 3 | #include "math.h" |
b0ssiz | 0:db3b9f12e4d5 | 4 | #define baud 115200 |
b0ssiz | 0:db3b9f12e4d5 | 5 | |
b0ssiz | 0:db3b9f12e4d5 | 6 | int main() |
b0ssiz | 0:db3b9f12e4d5 | 7 | { |
b0ssiz | 1:65ef1fe8e2f8 | 8 | /* |
b0ssiz | 1:65ef1fe8e2f8 | 9 | float x=-4525.2345,y=10.1234; |
b0ssiz | 0:db3b9f12e4d5 | 10 | Bear_Communicate com(PA_15,PB_7,baud); |
b0ssiz | 1:65ef1fe8e2f8 | 11 | com.setMotorPos(0x01,x,y); |
b0ssiz | 1:65ef1fe8e2f8 | 12 | */ |
b0ssiz | 1:65ef1fe8e2f8 | 13 | |
b0ssiz | 1:65ef1fe8e2f8 | 14 | float x=0,y=0; |
b0ssiz | 1:65ef1fe8e2f8 | 15 | Bear_Communicate com(PA_15,PB_7,baud); |
b0ssiz | 1:65ef1fe8e2f8 | 16 | com.getMotorPos(0x01,&x,&y); |
b0ssiz | 1:65ef1fe8e2f8 | 17 | printf("\nx=%f\n",x); |
b0ssiz | 1:65ef1fe8e2f8 | 18 | printf("y=%f\n",y); |
b0ssiz | 1:65ef1fe8e2f8 | 19 | |
b0ssiz | 0:db3b9f12e4d5 | 20 | } |