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, 2:48 PM EST
thank you asfend sir
Asfend YarPosted Feb 29, 2016, 9:20 AM EST
nic
Sr KarthigaPosted Feb 21, 2016, 6:21 PM EST
Thank you saineshwar sir
Saineshwar BageriPosted Feb 21, 2016, 6:06 PM EST
Nice one
Sr KarthigaPosted Feb 20, 2016, 2:48 PM EST
thank you sibeesh sir
Sr KarthigaPosted Feb 20, 2016, 2:48 PM EST
Thank you mohammed sir
Sr KarthigaPosted Feb 20, 2016, 2:47 PM EST
thank you gowtham sir
Sr KarthigaPosted Feb 20, 2016, 2:47 PM EST
Thank you kumaresh sir
Sibeesh VenuTOP 100Posted Feb 19, 2016, 8:42 PM EST
Nice Share
Mohammed IbrahimPosted Feb 19, 2016, 9:48 AM EST
nice
Gowtham KTOP 100Posted Feb 19, 2016, 7:40 AM EST
Good One
Kumaresh RajalingamPosted Feb 18, 2016, 3:20 PM EST
Nice share