Arduino wie kann ich eine Verzögerung für ein Blink-Programm programmieren?

ich möchte das Blinken um 45 Minuten verzögern und wenn es dann Blinkt, soll das Blinken durch drücken eines Tasters gestoppt werden und die Wartezeit bis zum Blinken soll wieder bei Null beginnen.

Weiß hier jemand wie man das macht?

Also der Wechselblinker der im Wechsel die LEDs blinken lässt funktioniert bereits

void setup() // wir starten mit dem Setup
{
 pinMode(5, OUTPUT); // Pin 5 ist ein Ausgang.
 pinMode(7, OUTPUT); // Pin 7 ist ein Ausgang.
}

void loop() // das Hauptprogramm beginnt.
{
 digitalWrite(5, HIGH); // schalte die LED an Pin 5 an.
 delay(200);      // warte 200 Millisekunden.
 digitalWrite(5, LOW);  // schalte die LED an Pin 5 aus.
 digitalWrite(7, HIGH); // Schalte die LED an Pin 7 ein.
 delay(200);      // warte 200 Millisekunden.
 digitalWrite(7, LOW);  // schalte die LED an Pin 7 aus.
}
(1 votes)
Loading...

Similar Posts

Subscribe
Notify of
3 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Kelec
11 months ago

Go to a waiting loop and count with Millis the past time.

uint32_t startTime = millis();
while(millis()-startTime < 2700000);

Stop the version for 45min. When you restartTime=millis(); then you can put the delay back to 45min.

However, there is an overflow problem here after about 50 days. The question is, however, whether your application will be on the move for so long.

ntechde
11 months ago

“Delay” you already know!

I’ll tell you in German so you can win something:

If (button pressed) { delay (45*60); }

Minihawk
11 months ago
Reply to  ntechde

Delay makes delays in militias, so 45*60*1000…