Go Down

Topic: cycling 4 LEDs at varrying speeds (Read 6 times) previous topic - next topic

JeffCoalfax

Quote
13 is convenient because most Arduino's already give you an LED connected to pin 13 through a series resistor, meaning you can upload the code to the board without adding any hardware. You're welcome to use whichever pin you like; you aren't tethered to pin 13.
understood, I changed it to 2 but I need to understand how to get 3,4 and 5 in there as well. so that I can have them blink with this code. Everything that I try gives me an error.

JeffCoalfax

Quote
Do you mean one after another? All at the same time? Binary counter? Random? The answer is yes to all, but the implementation is different

I mean, one after another

Arrch


Look, I got it. You don't want to help me, but there are others that are willing to so please if all you want to do is continue down this road, save yourself some time and don't respond at all.


Fair enough, it looks like my type of help isn't what you're looking for and the way I post is apparently very aggravating to you, so I'll let you work it out (hopefully) with someone else.

AWOL

#38
Oct 09, 2012, 07:19 am Last Edit: Oct 09, 2012, 09:21 am by AWOL Reason: 1
Quote
Everything that I try gives me an error.

We can't see
a) what you have tried
b) what the errors were.

You're making it very hard to help you.

Blink without delay analogy:

A call to "delay ()" is like setting your alarm clock and going to sleep until it goes off - you can't get any work done, because you're busy sleeping.

Instead, think about the egg boiling analogy.
In fact, let's simplify it, and have a flashlight, which you have to flash, with an "on" time of 20 seconds (human, not microprocessor timescales here) and an "off" time of 30 seconds.

You have a wall-clock that has a seconds hand and a sheet of paper with a pencil.

Fairly quickly, you'll see that the actual action of switching the flashlight on or off takes virtually no time at all, and happens only every 20 or 30 seconds.
Most of the rest of the time, you're just looking at the clock, seeing if your 20 or 30 seconds are up, but the important thing is, you're not sleeping.

Now, in between times, you could be performing tasks that operate at different rates, like making a cup of tea, or boiling eggs to different levels of hardness, answering the phone, answering the front door...
The key is to break the sequence down into small lumps that won't interfere with the others.
Fill, kettle, plug kettle in, switch kettle on(is kettle boiling?), get cup(is kettle boiling?), get spoon(is kettle boiling?), get tea(is kettle boiling?),  get milk (is kettle boiling?),...

Now, "loop()" provides you with a mechanism for repeatedly doing things, like looking at the "millis()" wallclock.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Nick Gammon

Wow! How did this thread escalate totally out of control? Halloween, I bet!

http://www.gammon.com.au/blink

Beware of the zombies.

Go Up