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:
- 12:7e11d1d5f22c
- Parent:
- 10:f8e7f39eae0d
- Parent:
- 11:f9f3014598b9
- Child:
- 13:f834d5e83e11
--- a/main.cpp Thu Mar 05 07:36:21 2020 +0000
+++ b/main.cpp Thu Mar 05 07:58:01 2020 +0000
@@ -1,3 +1,4 @@
+//a
#include "mbed.h"
#include "EC.h"
#include "SpeedController.h"
@@ -154,6 +155,9 @@
a++;
}
}
+
+double a=1;
+
int main()
{
gyro.initialize(); //main関数の最初に一度だけ実行
@@ -205,20 +209,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);
}
}