Keypress & loop()

To debug better my code i need something like a breakpoint into loop() using keypressed coming from serial
Which is the best way to do it?


@blondie63, use Serial.available() to see if a key is available and then go empty the buffer so you don’t get multiple triggers:

if (Serial.available()) {
  //key has been pressed so "breakpoint" stuff here;  //Read to remove char from buffer to avoid multiple triggers
  //Breakpoint code goes here

now i understand my error, missing…

1 Like