I tried searching the topics but couldn't find a good solution. I want my Arduino to blink a led for 10 times. But if I press a button in my interface it has to interrupt the while loop. But I can't click anything else because of the while loop. How can I avoid the while loop so it's possible to interrupt the blinking of the led before reaching the end of the loop?
Thanks in advance.
code:
import controlP5.*; import processing.serial.*; import cc.arduino.*; Arduino arduino; ControlP5 controlP5; Button b; int buttonValue = 0; int myColor = color(0,255,180); boolean A = true;
void setup() { size(640,480); smooth(); frameRate(30); controlP5 = new ControlP5(this); controlP5.addButton("buttonA",0,100,100,80,19); controlP5.addButton("buttonB",0,100,150,80,19); controlP5.addButton("buttonC",0,100,200,80,19); arduino = new Arduino(this, Arduino.list()[0], 57600); }