But when users enter something that's not a number, the LEDs stop working. So, I'm planning to do something to keep them working in a default mode and send out a signal to let users know there's something wrong with their input.
*An iteration:
In the refined version of my code, I introduced a new function, parseBlinkInterval, which robustly converts the incoming string to an integer and validates it. This function uses strtol for conversion and checks if the entire string was valid for conversion. If not, it returns -1 as an error indicator.
Back in the ledControl function, I added a check for the -1 error code from parseBlinkInterval. If an invalid interval is detected, I default the blinking to a standard delay of 1000 milliseconds as a fallback, ensuring the program remains operational even with incorrect input.