Commit 041da76b authored by Michael Nelson's avatar Michael Nelson

Early return if scooter is off

parent 139b370d
......@@ -27,10 +27,15 @@
// Inputs
#define PIN_IN_LEFT_BUTTON 4
#define PIN_IN_RIGHT_BUTTON 5
#define PIN_IN_SCOOTER_STATUS 2
// TODO
// #define PIN_IN_BLUE_SOLID 10
// #define PIN_IN_BLUE_STRIPED 11
// Outputs
#define PIN_OUT_LEFT_BUTTON_LED 2
#define PIN_OUT_RIGHT_BUTTON_LED 3
#define PIN_OUT_LEFT_BUTTON_LED 12
#define PIN_OUT_RIGHT_BUTTON_LED 13
#define PIN_OUT_SPEAKER 6
#define PIN_OUT_BLINKER_L 7
......@@ -74,6 +79,7 @@ void setup()
pinMode(PIN_IN_LEFT_BUTTON, INPUT_PULLUP);
pinMode(PIN_IN_RIGHT_BUTTON, INPUT_PULLUP);
pinMode(PIN_IN_SCOOTER_STATUS, INPUT_PULLUP);
pinMode(PIN_OUT_SPEAKER, OUTPUT);
pinMode(PIN_OUT_BLINKER_L, OUTPUT);
......@@ -275,8 +281,16 @@ void reset_all()
digitalWrite(PIN_OUT_WHITES, LOW);
}
bool scooter_is_off()
{
return digitalRead(PIN_IN_SCOOTER_STATUS) == LOW;
}
void loop()
{
if (scooter_is_off())
return;
delay(1);
set_up_mode();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment