Changed arduinos code to support the emergency stop function