Compare commits
2 Commits
05937b1738
...
a6b028b701
Author | SHA1 | Date |
---|---|---|
|
a6b028b701 | |
|
864f0128f1 |
5
IO.hpp
5
IO.hpp
|
@ -90,8 +90,7 @@ class IO {
|
|||
{
|
||||
static unsigned long last_color_change_time {0};
|
||||
static bool has_color_changed {true};
|
||||
|
||||
bool is_color_blue = (digitalRead(PIN_BUTTON_COLOR) == HIGH);
|
||||
static bool is_color_blue {true};
|
||||
|
||||
if(m_is_color_blue != is_color_blue)
|
||||
{
|
||||
|
@ -125,6 +124,8 @@ class IO {
|
|||
m_is_tirette_pulled = (digitalRead(PIN_TIRETTE) == HIGH);
|
||||
m_is_color_blue = is_color_blue;
|
||||
|
||||
is_color_blue = (digitalRead(PIN_BUTTON_COLOR) == HIGH);
|
||||
|
||||
if(m_is_motor_control_activated)
|
||||
{
|
||||
m_updateMotorsControl();
|
||||
|
|
26
Main.ino
26
Main.ino
|
@ -6,7 +6,7 @@
|
|||
#include "IO.hpp"
|
||||
|
||||
// Unit tests activation
|
||||
#define UNIT_TESTS
|
||||
//#define UNIT_TESTS
|
||||
|
||||
/*
|
||||
Etapes :
|
||||
|
@ -136,15 +136,6 @@ void loop()
|
|||
break;
|
||||
|
||||
case State::Turn90Blue:
|
||||
my_IO.setDirWithAngularSpeed(90.0f);
|
||||
|
||||
if(my_IO.getAngle(Axes::Z) >= 88.0f)
|
||||
{
|
||||
actual_state = State::ForwardToSceneEdge;
|
||||
}
|
||||
break;
|
||||
|
||||
case State::Turn90Yellow:
|
||||
my_IO.setDirWithAngularSpeed(-90.0f);
|
||||
|
||||
if(my_IO.getAngle(Axes::Z) < -88.0f)
|
||||
|
@ -153,10 +144,19 @@ void loop()
|
|||
}
|
||||
break;
|
||||
|
||||
case State::ForwardToSceneEdge:
|
||||
my_IO.setSpeed(2048.0f);
|
||||
case State::Turn90Yellow:
|
||||
my_IO.setDirWithAngularSpeed(90.0f);
|
||||
|
||||
if(my_IO.getAngle(Axes::Y) > 1.0f)
|
||||
if(my_IO.getAngle(Axes::Z) >= 88.0f)
|
||||
{
|
||||
actual_state = State::ForwardToSceneEdge;
|
||||
}
|
||||
break;
|
||||
|
||||
case State::ForwardToSceneEdge:
|
||||
my_IO.setSpeed(1024.0f);
|
||||
|
||||
if(my_IO.getAngle(Axes::Y) > 2.0f)
|
||||
{
|
||||
actual_state = State::Dancing;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue