Hi all,
I am using void loop to run the code continuously, by showing temperature and pressure on serial monitor for every 5 Seconds. However, I am unable to do so because using the "if" function, once the condition met it does not run for every 5 seconds, despite me adding another loop(), delay(5000) and even use while function etc. It only showed once on serial monitor.
I need to show the temperature and pressure continuously for 5 seconds on OP of serial monitor. Anyone can help with this?
Attaching the code here:
void loop() // run over and over
{
recvData();
parseNewData();
if (i > 6) {
Serial.print("The temperature of the vacuum pump is LP Temp(degC): ");
Serial.println(splitdata[6]);
}
if (i > 2) {
Serial.print("The pressure of the vacuum pump is(mBar): ");
Serial.println(splitdata[2]);
}
//data was received and processed
if (newData == true) {
newData = false;
getPumpStatus(); //new pump status request
delay(5000); //arbitrary delay for requesting periodicaly
{
loop();
delay(5000);
}
}
}
thanks in advance!