I have this really simple sketch where I blink a led light. If I send another value threw the serial monitor then first there is always a brief second where the light doesn't blink anymore. Why is that, and how can I get rid of that?
int the_delay = 300;
void setup() {
Serial.begin(115200);
pinMode(12, OUTPUT);
}
void loop() {
digitalWrite(12, HIGH);
delay(the_delay);
digitalWrite(12, LOW);
delay(the_delay);
}
void serialEvent() {
if (Serial.available()) {
the_delay = Serial.parseInt();
Serial.println(the_delay);
}
}
In case it helps, eventually I would like to send values with 60fps.