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.
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.
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.