Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 5:62de7a36d3af
- Parent:
- 4:00ac3d093b24
- Child:
- 6:28b7339892f9
--- a/main.cpp Mon Sep 26 14:01:47 2016 +0000 +++ b/main.cpp Tue Sep 27 05:24:37 2016 +0000 @@ -13,8 +13,8 @@ Timeout timeouter1,timeouter2; int flag=0; float sum1=0,sum2=0,count1=0,count2=0,timecount1=0,timecount2=0,timesum1=0,timesum2=0,v,argv; -int16_t x=0,y=0,i=2; -int8_t button = 0; +int16_t x=0,y=0,throttle = 0,rudder = 0,i=0; +int8_t button=0,hat = 0; long microsecondsToCentimeters(long microseconds); void reset() @@ -27,6 +27,14 @@ void output() { printf("\n|v|: %lf theta: %lf\n",v,argv); //最終的にだすやつ + x = argv; + y = v; + i=2; + + wait(1); + button = (i<<8) & 0x0F; + + joystick.update(throttle, rudder, x, y, button, hat); } int main() @@ -65,6 +73,7 @@ } if(flag==1) { timeouter1.detach(); + timeouter2.detach(); timeouter2.attach(&output, 1); timeouter1.attach(&reset, 5); } @@ -130,11 +139,7 @@ } wait_ms(10); } - button = (i >> 8) & 0x0F; - x = argv; - y = v; - joystick.update(x, y, button); } long microsecondsToInches(long microseconds)