Hi guys,
it seems quite easy but in some way I´m stuck - I need to find a way updating my (temperature) Display while waiting. Delay() obviously doesn´t work and with the Timer libraries I tried it didn´t come around (maybe just used in a wrong way). Anyways, to make it more concrete here is the code:
//depending on switchByte it switches to either case 1 or 2
if (switchByte == 0){
state = 1;
}
else if(switchByte == 1){
state = 2;
}
switch (state){
case 1:
// Now it should take the delayByte (i.e. 3 seconds) and updating the Display (displayTemperature() ) while waiting, so I can´t use the delay function
?????
// after the 3 Seconds do something else
....
}
void displayTemperature(){
....
}
WOuld appreciate very much your help on that. Thanks!
While waiting for what? You really need to define your requirements. Reading two ints on every pass through loop() is a BAD idea. If nothing is available on the serial port, a bunch of time will be wasted and then switchByte and delayByte will both be 0.