void setup() {
Serial.begin(115200);
}
/* Z funkcijo delay() */
void loop() {
Serial.println("ALARM");
delay(500);
}
/* Z funkcijo millis() */
void loop() {
static unsigned long Prejsni_cas = 0;
unsigned long zdej = millis();
if (zdej - Prejsni_cas >= 500) {
Serial.print("ALARM");
Prejsni_cas = millis();
}
}
/*
unsigned long changeTime;
int casDelay = 500;
bool m = HIGH;
void setup() {
Serial.begin(115200);
chaneTime = millis();
}
void loop() {
if (millis() - chaneTime > casDelay) {
chaneTime = millis();
m = !m;
}
if (m == LOW) Serial.println("vklop");
else if (m == HIGH) Serial.println(("izklop"));
}
*/