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