What I want to be able to do is to enter the time as separate elements, but its not waiting as it should.
Test Code
char hrs[3];
char mins[3];
void setup()
{
Serial.begin(57600);
Serial.println("Serial Connected");
// Input time
Serial.println("Input time hh");
Serial.flush();
while (!Serial.available()); // Stop and Wait for input
for (byte x= 0; x < 2; x++)
{
hrs[x] = Serial.read();
hrs[3] = 0; //null char
delay(10);
}
Serial.print("Hours are set to ");
Serial.println(hrs);
Serial.println("Input time mm");
Serial.flush();
while (!Serial.available()); // Stop and Wait for input
for (byte x= 0; x < 2; x++)
{
mins[x] = Serial.read();
mins[3] = 0; //null char
delay(10);
}
Serial.print("Minutes are set to ");
Serial.println(mins);
}
void loop(){
// Do Stuff
}
Thanks.