Multi Arduino Knight rider light with 12 LEDs and a Potentiometer

Hi everyone, hope all is well!

I got interested in master and slave method,in blinking led's.

Can you please guide me in programming this question?

Ques: Take 12 red LEDs, and arrange them in a row (Refer to the figure below). The LEDs are numbered as 1, 2, 3, 4, 5, ... and 12. Next, take an Arduino UNO board and connect these LEDs to the board. Take a second Arduino UNO board and connect a potentiometer to it. You are connecting 12 LEDs to First Arduino and a potentiometer to the second Arduino. Rotating the potentiometer clockwise in the first Arduino should increase the speed of LED chasing in the second Arduino and rotating the potentiometer anti-clockwise should decrease the speed of LED chasing. The minimum chasing speed should be 1 second and the maximum speed should be 1 millisecond.

Thank you

That sounds very much like an assignment that you have been given.

When are we required to hand it in ?

1 Like

Depending on your real application, there are probably two three easier, cheaper and more flexible ways to do what you’re asking.

Why?

Because that is what the assignment calls for ?

How far apart are the arduinos?

How are they connected together, serial line, I2C, bridged through a computer using USB cables?

Hello
The answer:
As you like.

The easiest way would be to connect the potentiometer to +5V, Gnd, and A0 on the second Arduino, then connect +5V, Gnd, and A0 from the second Arduino to the same pins on the first Arduino. The beauty of this arrangement is that the second Arduino doesn't need a sketch. :slight_smile:

Another way, if that method is considered 'cheating', is to put this line in loop() on the second Arduino:
analogWrite(3, analogRead(A0) / 4);
Connect Gnd and Pin 3 from the second Arduino to Gnd and Pin 3 on the first Arduino. The first Arduino can then use pulseIn(3, HIGH) and pulseIn(3, LOW) to get a value from the second Arduino.

Another unconventional method, read the potentiometer on the first arduino and pulse an output pin at the desired scan rate for the leds. The second arduino reads the signal from that pin and advances the led scan on a level transition.

More conventionally, just read the potentiometer, divide by four to get the value as a single byte (to simplify things), and write the value to Serial. Second arduino then just reads the serial data.

1 Like

Hi,

I like that, the pot UNO outputs the variable clock pulse and the LED UNO strobes the LEDs.

Tom... :grinning: :+1: :coffee: :australia:
PS. If it is an assignment, it didn't say what data transfer system to use between the two UNOs, so let your imagination run riot.

First, it's not a programming question. It's a design question.
Which communication method do you want to use?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.