This is great. Since my Project IS actually a connected LED Lamp i can mirror the Status LED to the whole lamp indicating if it is connected or not. I was surprised it even works in listening mode which is just perfect for my case - thought i have to wait until the System Code runs in another Thread.
This works fine for me with a Neopixel ring:
SYSTEM_MODE(SEMI_AUTOMATIC);
void setup() {
RGB.onChange(ledChangeHandler);
pinMode(irqpin, INPUT);
digitalWrite(irqpin, HIGH);
Wire.begin();
mpr121_setup();
strip.begin();
strip.show();
strip.clear();
strip.show();
Particle.connect();
while(!Particle.connected()) {
Particle.process();
delay(1);
}
// Other Stuff
colorWipe(strip.Color(0, 0, 0), 40);
}
void ledChangeHandler(uint8_t r, uint8_t g, uint8_t b) {
if(!Particle.connected()) {
colorNoWipe(strip.Color(r, g, b));
}
}