cattledog:
int period = 40000;What's the largest number that can fit into an int?
What error is delay "throwing".
You are not using the milis() function for timing in the correct non blocking way. The while loop is blocking your code in the same fashion as delay(). If you want to do something after an interval, then
//int period = 40000;
unsigned long period = 4000;
unsigned long time_now = 0;
unsigned long time_previous = 0;
void setup() {
Serial.begin(115200);
}
void loop() {
time_now = millis();
if(time_now - time_previous >= period)
{
time_previous = time_now; //alternatively, use time_previous += period for a more constant interval
Serial.println("Hello");
}
//while(millis() < time_now + period){
//wait approx. [period] ms
//}
}
What's the largest number that can fit into an int? 32767
What error is delay "throwing". This is an error caused by the way it is reading my dial indicator, not the program.
Your suggestion works great as you posted it but I'm not using it correctly in my code because it doesn't function at all. I will include the code with all I am trying to do.