Skip to content

Magic Button Functions

Quymbee Chen edited this page Dec 26, 2016 · 3 revisions

There are three Magic Button functions that allows you to change the events of certain button presses. These three functions available are for pressing the Magic Button unplugged, pressing the Magic Button plugged, and pressing the Magic Button for 2 seconds.

You can use any of these functions independently or all together.

See Also:

COMPONENT INITIALIZATION

// To use the Magic Button in Arduino,
// use the following functions to define what happens

  void button_press(void){
    // Define what happens when the Magic Button is pressed quickly
    // (when the Jewelbot is not plugged into power)
  }
  void button_press_long(void) {
    // Define what happens when the Magic Button is held for 2 seconds
    // (when the Jewelbot is not plugged into power)
  }
  void charging_button_press(void) {
    // Define what happens when the Magic Button is pressed quickly
    // (when the Jewelbot is plugged into power)
  }

API

  • button_press(void)

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

    LED led;
      void button_press_long(void){
        led.turn_on_single(SE, YELLOW);
      }
  • charging_button_press(void)

    LED led;
      void charging_button_press(void){
        led.turn_on_single(NW, BLUE);
      }
Clone this wiki locally