check the code below, while executing the for-loop, LED Blink function stops
i want to blink LED process to continue throughout, while my for-loop is executing
const int ledPin = 12; // the number of the LED pin
int z=0;
int i=0;
int ledState = LOW; // ledState used to set the LED
long previousMillis = 0; // will store last time LED was updated
long interval = 1000; // interval at which to blink (milliseconds)
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop()
{
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > interval) {
previousMillis = currentMillis;
if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;
digitalWrite(ledPin, ledState);
}
z=0;
for(i=0; z <1000; i++)
{
Serial.println(z);
z++;
}
}
i use LED to set the status of my GPS (NO FIX - shortblink, 2D - Long Blink, 3D - ON).
So timer may help me
please provide me some sample codes or references
The for loop will block for however long it takes to print a thousand integers.
Hopefully, a GPS status function will not block, and if it does, rewrite it so that it doesn't block.