Control Omron G5LE-1 relay that requires 12V to switch the relay on and off. The relay it self is turning a 220VAC circuit on and off.
Control relay with TIP120
Posted on by ellen
2
Transistor controls other power source
Posted on by ellen
Using a potentiometer to control LED
Posted on by ellen
You can easly control the current running through your LED by adding a potentiometer as part of your circuit.
To control the LED with Arduino programming you attach the potentiometer to your analog in and let your Arduino program decide how much to dim the LED depending on the input you get from the potentiometer.
The input from analogRead returns a value between 0 and 1023. The analogWrite takes values between 0 and 255. The code below show you have to convert your analog in value to make your LED shine as bright as possible when the potentiometer is fully on.
-
int ledPin = 3;
-
int potentiomenterInput = 0;
-
-
void setup() {
-
pinMode(ledPin, OUTPUT);
-
}
-
-
-
void loop() {
-
-
potentiomenterInput = (analogRead(0)/4); // Divides input 0-1023 to resemble to 0-255
-
-
analogWrite(ledPin, potentiomenterInput);
-
// The delay can be change to get the desired dimming effect
-
delay(20);
-
}