Potentiometer Arduino LED

by Charlotte-Coding16 in Circuits > Arduino

73 Views, 0 Favorites, 0 Comments

Potentiometer Arduino LED

Intro.jpg

Legal Disclaimer* This is a high school Mech 1 assignment for the current teacher Mr. Sweet. Should anything happen, he is liable for all damages from this Instructables. His contact is esweet@egusd.net.

Supplies

Bread.jpg
LED.jpg
Potentiometer.png
Resistor.png
Wires.jpg

Bread Bored

LED

6 Wires

Potentiometer

Arduino

Computer

Wire that connects Arduino to Computer

Downloads

Connect Power Wires to Arduino

F1KF505M0FAPJYD.jpg

Take two wire for the negative and positive of the Breadboard. Attach negative wire to the Arduino GND. Then attach the positive wire to 5V.

Then Connect Power to Potentiometer

FBD4FIWM0FAPJY2.png
F1KF505M0FAPJYD.jpg

Attach a new wire to A0, then place in the middle row of the Potentiometer on your bread bored.

Connect Potentiometer to Negative and Positive

FBD4FIWM0FAPJY2.png
FM1YIKWM0FAPJXV.jpg
F1KF505M0FAPJYD.jpg

Using the other two rows of the potentiometers, put in same colum as the wires for Positive and Negative on the breadboard.

Take Last Wire to Arduino 13

FYOPI1QM0FAPLDL.jpg
FWH89SMM0FAPJXY.jpg
FVNETKCM0FAPJY3.png

Put through a resistor, then LED. Have the resistor connect to the negative part of bread board.

Code

Code.png

void setup() {

// put your setup code here, to run once:

int ledPin = 13;

pinMode(ledPin, OUTPUT);

}

int potPin = A0;

void loop() {

// put your main code here, to run repeatedly:

int ledPin = 13;

digitalWrite(ledPin, HIGH);

delay(analogRead(potPin));

digitalWrite(ledPin, LOW);

delay(analogRead(potPin));

}

Plug Into Computer!