Wow, that formatting! A } should go on a blank matching line. After reformating
unsigned long lastTime=0 ;
void setup(){
pinMode(13,OUTPUT);
}
void loop(){
unsigned long currentTime = millis();
if (currentTime - lastTime >= 1000){
lastTime = currentTime;
digitalWrite(13,HIGH);
}
else{
digitalWrite(13,LOW);
}
}
But it works perfectly fine It does exactly what you tell it to. But problem i, that's probably not what you want. Because when time is over
if (currentTime - lastTime >= 1000){
Turns on the output just fine.
But next time the loop runs the statement isn't true anymore and then you turn off the output. And the loop runs very very fast so you don't even see it!