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 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)
|
||||||
{
|
{
|
||||||
|
@ -125,6 +124,8 @@ 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(2048.0f);
|
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;
|
actual_state = State::Dancing;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue