Controlling Desktop App
There are a few commands available in the driver itself to communicate back to the desktop app and control it:
- Start playing an animation in the desktop app with an optional index and time
- Stop playing any animation in the desktop app
- Turn Master Live off in Bottango (the same as pressing the escape key on the keyboard).
Available Methods
Section titled “Available Methods”outgoing_requestStartPlay
Section titled “outgoing_requestStartPlay”You can request start playing. In its simplest form as shown here, it’s the same thing as pressing spacebar or the play button in the app. Here’s an example reading the state of a button on pin 5 (with simple debounce) and requesting start if it’s pressed.
#define BUTTON_DEBOUNCE 500 unsigned long lastPressTime = 0;
void onEarlyLoop() { pinMode(5, INPUT);
bool buttonPressed = digitalRead(5) == LOW && millis() - lastPressTime >= BUTTON_DEBOUNCE; if (buttonPressed) { Outgoing::outgoing_requestStartPlay(); lastPressTime = millis(); } }You can optionally pass in a desired index and start time in MS as well. -1 in either parameter keeps the current selection in the app.
// start playing animation index 2, at 1000ms (1 second) into the start of the animation.Outgoing::outgoing_requestStartPlay(2, 1000);
// start playing the current animation selected in the app, at 1000ms (1 second) into the start of the animation.Outgoing::outgoing_requestStartPlay(-1, 1000);
// start playing animation index 2, at the current playtime in the appOutgoing::outgoing_requestStartPlay(2, -1);
// these two calls are identical:Outgoing::outgoing_requestStartPlay();Outgoing::outgoing_requestStartPlay(-1, -1);outgoing_requestStopPlay
Section titled “outgoing_requestStopPlay”You can request stop playing. In its simplest form as shown here, it’s the same thing as pressing spacebar or the pause button in the app while playing. Here’s an example reading the state of a button on pin 5 (with simple debounce) and requesting stop playing if it’s pressed.
#define BUTTON_DEBOUNCE 500 unsigned long lastPressTime = 0;
void onEarlyLoop() { pinMode(5, INPUT);
bool buttonPressed = digitalRead(5) == LOW && millis() - lastPressTime >= BUTTON_DEBOUNCE; if (buttonPressed) { Outgoing::outgoing_requestStopPlay(); lastPressTime = millis(); } }outgoing_requestEStop
Section titled “outgoing_requestEStop”You can request Master Live to be set not live. The method is named this way to distinguish it from stop-play requests, but you should not rely on it as a substitute for a real physical E-stop. Your E-stop should not be a software-only solution.
#define BUTTON_DEBOUNCE 500 unsigned long lastPressTime = 0;
void onEarlyLoop() { pinMode(5, INPUT);
bool buttonPressed = digitalRead(5) == LOW && millis() - lastPressTime >= BUTTON_DEBOUNCE; if (buttonPressed) { Outgoing::outgoing_requestEStop(); lastPressTime = millis(); } }