 }
 
 void loop() {
+	if (m_button_press) {
+		m_button_press = false;
+		m_automatic = true;
+	}
+
+	// handle debounce
+	if (!m_button_active && ((millis() - m_last_button_time) > START_BUTTON_DEBOUNCE_TIME_MS)) {
+		m_button_active = true;
+	}
+
 	while (SERIALDEV.available() > 0) {
 		m_rx_len = hdlc.decode(SERIALDEV.read());
 

Servo drivingservo;

bool m_automatic = false;

uint32_t last_time = 0;

MCDriver driver;


#define SERIALDEV Serial
#endif

#define START_BUTTON_DEBOUNCE_TIME_MS        250

#define TEENSY_LED          13
#define START_BUTTON        14

#define IR_LEFT             A9
#define IR_RIGHT            A8
#define IR_FRONT_LEFT       A7
