Introduction
- Arduino Mega 2560
- Potentiometer
- BreadBoard
- LED
Connection
Step 1: Connection from Potentiometer to Arduino Mega 2560:
- The first pin of the potentiometer can be connected to the Gnd of the Arduino Mega 2560.
- The second pin of the potentiometer can be connected to the Analog pin A0 of the Arduino Mega 2560.
- The third pin of the potentiometer can be connected to the 5V of the Arduino Mega 2560.
Step 2: Connection From Potentiometer To Arduino Mega 2560:
- Positive pin = 09
- Negative pin = Gnd
Programming
- const byte POTENTIOMETER = 0;
- const byte CONTROL = 9;
- int reading;
- int value;
- void setup()
- {
- pinMode(CONTROL, OUTPUT);
- }
- void loop()
- {
- reading = analogRead(POTENTIOMETER);
- value = map(reading, 0, 1024, 0, 255);
- analogWrite(CONTROL, value);
- }
Explanation
- When the potentiometer is adjusted the LED can be low to high
- In the potentiometer we can see the brightness of the LED.
Output

Figure 1: Output
Read more articles on Arduino:

Sr KarthigaPosted Feb 29, 2016, 7:48 PM
thank you asfend sir
Asfend YarPosted Feb 29, 2016, 2:20 PM
nic
Sr KarthigaPosted Feb 21, 2016, 11:21 PM
Thank you saineshwar sir
Saineshwar BageriPosted Feb 21, 2016, 11:06 PM
Nice one
Sr KarthigaPosted Feb 20, 2016, 7:48 PM
thank you sibeesh sir
Sr KarthigaPosted Feb 20, 2016, 7:48 PM
Thank you mohammed sir
Sr KarthigaPosted Feb 20, 2016, 7:47 PM
thank you gowtham sir
Sr KarthigaPosted Feb 20, 2016, 7:47 PM
Thank you kumaresh sir
Sibeesh VenuPosted Feb 20, 2016, 1:42 AM
Nice Share
Mohammed IbrahimPosted Feb 19, 2016, 2:48 PM
nice
Gowtham KPosted Feb 19, 2016, 12:40 PM
Good One
Kumaresh RajalingamPosted Feb 18, 2016, 8:20 PM
Nice share