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.
Dependencies: mbed SpeedController Encoder CruizCore_R1370P
Diff: main.cpp
- Revision:
- 11:f9f3014598b9
- Parent:
- 9:04291120b9ad
- Child:
- 12:7e11d1d5f22c
--- a/main.cpp Thu Mar 05 07:28:42 2020 +0000 +++ b/main.cpp Thu Mar 05 07:51:01 2020 +0000 @@ -154,6 +154,9 @@ a++; } } + +double a=1; + int main() { gyro.initialize(); //main関数の最初に一度だけ実行 @@ -205,20 +208,25 @@ vy=dy/sqrt((double)dx*dx+dy*dy); //四輪の出力計算 - omega.setOmega(10); + omega.setOmega(a); omega.setVxy(vx,vy); omega.calOmega(); if(dx<300 &&dx>-300) { if(dy<300 && dy>-300) { - n++; - printf("reached Location %d\r\n",n); - ticker.detach(); - for(int j=0; j<4; j++) { - motor[j].Sc(0); + a=a-0.1; + if(dx<50 && dx>-50) { + if(dy<50 && dy>-50) { + n++; + printf("reached Location %d\r\n",n); + ticker.detach(); + for(int j=0; j<4; j++) { + motor[j].Sc(0); + } + wait(2); + ticker.attach(motorOut,0.05); + } } - wait(2); - ticker.attach(motorOut,0.05); } }