// Alarm sketch 2: Crazy lights - use alarms to blink lights at different rates

u32 redPeriod = 1234, greenPeriod = 2345, bluePeriod = 3456;

void redHandler(u32 when) {
  ledToggle(BODY_RGB_RED_PIN);
  Alarms.set(Alarms.currentAlarmNumber(), when+redPeriod);
}
void greenHandler(u32 when) {
  ledToggle(BODY_RGB_GREEN_PIN);
  Alarms.set(Alarms.currentAlarmNumber(), when+greenPeriod);
}
void blueHandler(u32 when) {
  ledToggle(BODY_RGB_BLUE_PIN);
  Alarms.set(Alarms.currentAlarmNumber(), when+bluePeriod);
}

void setup() {
  Alarms.set(Alarms.create(redHandler),0); // Create and set redHandler alarm
  Alarms.set(Alarms.create(greenHandler),0); // Ditto greenHandler
  Alarms.set(Alarms.create(blueHandler),0);  // Ditto blueHandler
}

void loop() { 
  /* Nothing to do */
}
