Skip to content

Configuring Bailout Button

Jeffrey Shen edited this page Jul 24, 2017 · 4 revisions

It is helpful to have a button, for safety purposes, that stops all motors if the motor is malfunctioning. The library provides functionality to do that.

Setup

In config.c:

#define BAILOUT_BTN Btn7D //This is the button that when pressed, causes the bailout procedure

In addition, you need to define a method void bailOut() which should contain custom procedures to be run during the bailout procedure like global variables to toggle (motors are already automatically shut off). Furthermore, if you want other tasked to be triggered by this bailout, the BAILOUT variable will change to 1 when the bailout button is pressed

Example

#define BAILOUT_BUTTON Btn7D //This is the button that when pressed, causes the bailout procedure
void bailOut(){
  //Execute something here
}

Usage

Everything is set up now! If you press BAILOUT_BTN during user control, it will halt all motors and execute your custom bailOut method.