Description:
I reassembled my LED circuit for one LED and added in a potentiometer in order to control the blinking speed and then brightness. Though I am still weak in terms of understanding how circuits work, I figured out that only new connection between the Ardunio and Breadboard was the 5V, which powered the Potentiometer's 5V. I then connected Potentiometer's grounding and analog cables to the Ardunio.
Items used for this circuit:
- 1 Breadboard
- 1 220 resistor
- 3 long wires
- 1 Arduino board
- 1 Green LED
- 2 Potentiometers
- 3 Wires for each Pot (ground, 5v, analog)
Code used to Control 2 Pot LED:
//Created by David Cuartielles
//modified October 1 2013
//By Anthony
//This example code is in the public domain.
//http://arduino.cc/en/Tutorial/AnalogInput
int brightPin = A0; // select the input pin for the blink potentiometer
int blinkPin = A1; // select input pin for brightness potentiometer
int ledPin = 11; // select the pin for the LED
int bright = 0; // variable to store the value coming from the sensor
int blinkTime = 0;
void setup() {
// declare the ledPin as an OUTPUT:
pinMode(ledPin, OUTPUT);
}
void loop() {
bright = analogRead(brightPin); // read the value from the sensor:
blinkTime = analogRead(blinkPin);
Serial.println(blinkTime);
analogWrite(ledPin, bright/4);// turn the ledPin to
delay(blinkTime); // stop the program for some time
analogWrite(ledPin, 0); // turn the ledPin off
delay(blinkTime); // stop the program for some time
}
- Login to post comments