Please Help!

this is for uni and need some help

Q1.Connect more LEDs (remember the resistors), and have different LEDs pulse
at different speeds. Note that as the Arduino is single threaded (only do one
task at a time) you will have to achieve this by keeping track of the current
state of the program and checking to see if each LED should be lit or not.
Another way to achieve this is to millis() which returns the number of
milliseconds since the Arduino board began running the program.

basically i need to connect atleast two LEDs and have them blink at different speeds. i need to solve it using millis()

Please any help would be greatly appreciated :smiley:


The blink-without-delay would be a nice example of tactic needed.


yea i had a quick skim thanks for directing me (at a different lecture, so will read when get home). i would greatly appreciate perphasps some code fragments if any one could help me in that department

my code is pretty much identical to this(except different pin locations and some other little things)

void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);

void loop() {
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second

how can i modify the above to meet my problem?

Thanks is what you want as example. It does the same as the blink example you pasted but doesn't get 'stuck' in a delay(). You will have to learn how it works because i already do and i'm not in university, you are.