ARES
/
Timer
Time is good
Fork of Robot2016_2-0 by
Diff: main.cpp
- Revision:
- 86:0c5e9ac3d8d8
- Parent:
- 85:38cbf5fd22e1
- Child:
- 88:e4de39dd3e2e
--- a/main.cpp Fri May 06 09:49:01 2016 +0200 +++ b/main.cpp Fri May 06 10:05:33 2016 +0200 @@ -24,16 +24,20 @@ int main(void) { Ticker ticker; + Timeout end; ticker.attach(&Sharps, 0.01); + umbrella.setMode(0); umbrella.setMaxTorque(200); - umbrella.setGoal(0); + umbrella.setGoal(150); + depart(); if (SCouleur == VERT) { + end.attach(&endFonc, 10); GotoDist(5.5); } - else if (SCouleur == VIOLET) { - ; + else if (SCouleur == VIOLET) { + end.attach(&endFonc, 10); } else { TestDist3(2,2); @@ -70,74 +74,7 @@ drapeau = 2; } -void GotoDist(float timer) { - Timer t; - - roboclaw.SpeedAccelM1(accel_dista, vitesse_dista); - roboclaw.SpeedAccelM2(accel_dista, vitesse_dista); - - t.reset(); - t.start(); - - while (t.read() < timer) { - if (Ravance != 1) { - roboclaw.ForwardM1(0); - roboclaw.ForwardM2(0); - t.stop(); - while (Ravance != 1); - roboclaw.SpeedAccelM1(accel_dista, vitesse_dista); - roboclaw.SpeedAccelM2(accel_dista, vitesse_dista); - t.start(); - } - } - - roboclaw.ForwardM1(0); - roboclaw.ForwardM2(0); - - t.stop(); - t.reset(); - - wait(waiting_time); +void endFonc () { + umbrella.setGoal(150); + while (1); } - -void GotoThet (float timer, int signe) { - Timer t; - - if (signe < 0) { - roboclaw.SpeedAccelM1(accel_dista, vitesse_dista); - roboclaw.SpeedAccelM2(-accel_dista, -vitesse_dista); - } - else { - roboclaw.SpeedAccelM1(-accel_dista, -vitesse_dista); - roboclaw.SpeedAccelM2(accel_dista, vitesse_dista); - } - - t.reset(); - t.start(); - - while (t.read() < timer) { - if (Ravance != 1) { - roboclaw.ForwardM1(0); - roboclaw.ForwardM2(0); - t.stop(); - while (Ravance != 1); - t.start(); - } - if (signe < 0) { - roboclaw.SpeedAccelM1(accel_dista, vitesse_dista); - roboclaw.SpeedAccelM2(-accel_dista, -vitesse_dista); - } - else { - roboclaw.SpeedAccelM1(-accel_dista, -vitesse_dista); - roboclaw.SpeedAccelM2(accel_dista, vitesse_dista); - } - } - - roboclaw.ForwardM1(0); - roboclaw.ForwardM2(0); - - t.stop(); - t.reset(); - - wait(waiting_time); -} \ No newline at end of file