buttonled.cpp

A quick demo showing how to determine whether the on-board push button is pressed or not.

// Light an LED while the button is pushed down

void setup() { /* nothing needed */ }

void loop() { 
  if (buttonDown())             // If button currently pressed
    ledOn(BODY_RGB_RED_PIN);    // Raise the red lantern
  else
    ledOff(BODY_RGB_RED_PIN);   // Else don't

  // Note this could have been a 'one liner'!  Like this:
  // void loop() { ledSet(BODY_RGB_RED_PIN, buttonDown()); }
}

Generated on Fri Apr 22 06:54:10 2011 for SFB by doxygen 1.5.9