Welcome

Firmware - Buttons

Webpage under construction

Buttons

The buttons are debounced and checked through a hardware interrupt. There are 4 callback functions:


onHoldNotificationCallback_client;
onHoldReleasedCallback_client;
onClickCallback_client;
onReleaseCallback_client;
      

These are the button names:


BUTTON_LEFT,
BUTTON_RIGHT,
BUTTON_BOTH
      

Here's an example of setting a button callback from within a sketch:


robotbutterfly.onHoldNotificationCallback_client = buttonHoldNotificationCallback;
      

Remember to define the function prototype at the top of the sketch (before setup)


void buttonHoldNotificationCallback(uint8_t n);
      

Then we can implement that callback function, and check the button name:


void buttonHoldNotificationCallback(uint8_t n) {

  if(n == BUTTON_BOTH) {
    // do something when both buttons are held
  }

}