Skip to content

Commit

Permalink
Increase cycle time. Closes #16
Browse files Browse the repository at this point in the history
  • Loading branch information
aviborg committed Dec 25, 2023
1 parent 280b4a0 commit 377659d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ void loop()
static bool dataReceived = false;
unsigned long now = millis();
// Reading serial data should be uninterrupted
// When a serial read is detected other stuff is delayed 13 ms
// When a serial read is detected other stuff is delayed 61 ms
// using a timeout not divisible by 1000 (even) and a prime number
// reduce the risk of having the server working while data is received
if (hanReader.read()) {
lastUpdate = now;
dataReceived = true;
}
else {
if (now - lastUpdate > 13) {
if (now - lastUpdate > 61) {
lastUpdate = now;
if (dataReceived) {
digitalWrite(LED_BUILTIN, LOW); // Lit up LED
Expand Down

0 comments on commit 377659d

Please sign in to comment.