Adjustable LED flasher-first potentiometer using Arduino

Today we will make a Adjustable LED flasher-first potentiometer using Arduino. It is first time that we use it.

First to use potentiometer on Arduino
Arduino has the analog input pin (A0 to A5 for read any signals. When we apply voltage to potentiometer and to analog input pin Arduino. We can apply to control electornics appliance. When we rotate the potentiometer make a voltage across it change. The arduino can read this changing. As Figure 1 analog input pins and Power output pins that we use with the potentiometer.

analog-input-and-power-output
Figure 1 Analog input and Power output

Parts you will need
We have to find the parts below.
• Arduino UNO R3
• potentiometer 100K
• one LED
• 470 ohms resistor
• jumper wires
• Breadboard

How to builds
We look at schematic in Figure 2 and then connect circuits as Figure 3 and Figure 4.
adiustadle-led-flasher-using-arduino_schem
Figure 2 Schematic

adiustadle-led-flasher-using-arduino_bb
Figure 3 Circuit connection

adjustable-LED-flasher-first-potentiometer-using-Arduino
Figure 4 Adjustable LED flasher first potentiometer using Arduino

Next we write the LED flasher code on the arduino IDE as Figure 5

1-LED-flasher-Arduino-IDE-code
Figure 5 1 LED flasher Arduino IDE code

  1. /*
  2. First time for learn to use the potentiometer by AnalogRead.
  3. */
  4.  
  5. int LEDPin = 8;
  6.  
  7. void setup() {
  8. pinMode(LEDPin , OUTPUT);
  9.  
  10. }
  11.  
  12. void loop() {
  13. // read the input on analog pin 0:
  14. int delay1 = analogRead(A0);
  15.  
  16. delay(1); // delay in between reads for stability
  17.  
  18. digitalWrite(LEDPin, HIGH); // turn the LED on (HIGH is the voltage level)
  19. delay(delay1); // wait for a second
  20. digitalWrite(LEDPin, LOW); // turn the LED off by making the voltage LOW
  21. delay(delay1); // wait for a second
  22. }

We will see that command “analogRead(A0” to used to read the analog or voltage.
Then the arduino will be processed into any one variable from 0-1023 we bring the value to delay1. For the one LED flasher code can read at one LED flasher


As video we test to rotate the potentiometer cause LED flasher slow-fast.

Add a Comment

Your email address will not be published. Required fields are marked *