Back

How to Code events for the Jewelbots' Magic Button

There is only one Magic Button function that allows you to change the effect of a button press and only under a specific circumstance. A single button press function is available when the Jewelbot is unplugged and doesn't have any friends to show. This function will allow you to code a really cool effect and show it off to your friends, while keeping all the friendship functionality.

COMPONENT INTIALIZATION

// To use the Magic Button in Arduino, // use the following functions to define what happens // include the "set_arduino_button()" function in your setup void setup() { // Required first setup command here set_arduino_button(); } void button_press(void){ // Define what happens when the Magic Button is pressed quickly // (when the Jewelbot is not plugged into power) }

You can use the function below independently and add LEDs, LED Animations, or Buzzers inside.

The function is called an event, because it is triggered by an interaction on the device. Events are ways you can trigger things to happen after you do something else, in this case after pressing the button.

API

button_press(void)

This function happens when you hit your button one time.

void button_press(void){ LED led; led.turn_on_single(NW, GREEN); }