 Servo drivingservo;
 
 bool m_automatic = false;
+uint32_t last_time = 0;
 
-uint32_t last_time = 0;
+bool m_button_press = false;
+bool m_button_active = false;
+bool m_last_button_time = 0;
 
 MCDriver driver;
 

#define SERIALDEV Serial
#endif

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

}

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());

