Serial.println("Enter seconds to time");
if (Serial.available()> 0)
float timeInput = Serial.read(); // Take input from serial monitor.
timeInput = timeInput - 48; // Todo: for some reason processor adds 48 to input, this corrects that.
timeInput = timeInput * 1000; //Converts time input to milliseconds.
delay(timeInput); // Counts down to zero timeInput.
There are two problems I am having with this sketch. When I input a number of seconds to count down, the compiler adds 48 to it. Further, if I input a two digit number such as 12, it treats the 1 then the 2
as separate entries. The sketch does work for a single-digit entry. Thanks.