Trying To Get Led To Blink 10 Times, Don't Know What's Wrong
Maybe your like
const int LED = 13; int count = 0;
void setup() { pinMode (LED, OUTPUT);
} void blinkLED(int timeOn, int timeOff, int numBlinks) { for (count= 0; count <= numBlinks-1; count++) { digitalWrite(LED, HIGH); delay(timeOn); digitalWrite(LED, LOW); delay(timeOff); } }
void loop() { blinkLED(1000,1000,10); }
Grumpy_Mike January 22, 2018, 10:25pm 2Nothing wrong with that code it works. Except of course it is not posted correctly, read How to use this forum
What is it doing that you don't want it to do?
Are you expecting it to stop after 10 blinks? No the loop function will repeat the blinks over and over.
peppermintt January 22, 2018, 10:26pm 3It doesn't blink 10 times, it just keeps going and doesn't stop
Grumpy_Mike January 22, 2018, 10:27pm 4Yes it will. The loop function does just that it loops.
PaulRB January 22, 2018, 10:31pm 5Move this line
blinkLED(1000,1000,10);from loop() into setup()
Grumpy_Mike January 22, 2018, 10:33pm 6Or add
while(1) { }To the end of the loop function.
Related topics
| Topic | Replies | Views | Activity |
|---|---|---|---|
| 10 Blinks Programming | 3 | 1167 | May 5, 2021 |
| TinkerCad - LED blink LEDs and Multiplexing | 1 | 1188 | May 6, 2021 |
| How to repeat a loop only a certain number of times? Programming | 16 | 124317 | May 5, 2021 |
| How do i blink the LED's for 100 times and then turn them off with the micros()? Programming | 6 | 388 | November 9, 2022 |
| Problem with 10 leds blinking project. Programming | 6 | 1301 | May 6, 2021 |
Tag » Arduino Blink Led 10 Times
-
How To Make A Led Blink 5 Times And Stop? - Arduino Forum
-
Problem With 10 Leds Blinking Project. - Arduino Forum
-
Arduino 2 Led Blink
-
Blink Led 5 Times With For Loop - Arduino Stack Exchange
-
Program For Blinking Led Quickly For Some Time And Then Slowly On ...
-
Tutorial 06: Blink An LED - Programming Electronics Academy
-
Blink LED At Specify Time With Matlab - Arduino - - MathWorks
-
Multiple Blinking LED On The Arduino : 4 Steps - Instructables
-
5 Ways To Blink An LED With Arduino - Wokwi Makers Blog
-
Blinking Multiple LEDs Using The Loop - JavaTpoint
-
[PDF] Activity 2: Making An LED Blink Worksheet Answer Key
-
Arduino LED Blink Using Millis With Different ON And OFF Time
-
Why Doesn't This Stop Blinking After I = 5? : R/arduino - Reddit