Add the following snippet to your HTML:<iframe frameborder='0' height='385' scrolling='no' src='https://www.hackster.io/sumanbargavr/working-with-a-potentiometer-and-two-leds-1d3120/embed' width='350'></iframe>
This project demonstrates the use of a potentiometer to control two LEDs.
Read up about this project on
This project demonstartes the use of Potentiometer to controltwo LEDs.
Also Visit
To control two LEDs with a potentiometer. (One Fade-IN and other Fade-OUT)
const int analog_ip = A0; const int LED1 = 3; const int LED2 = 9; int inputVal = 0; void setup() { pinMode (LED1, OUTPUT); pinMode (LED2, OUTPUT); } void loop() { inputVal = analogRead(analog_ip); analogWrite (LED1, inputVal/4); analogWrite (LED2, (1023-inputVal)/4); }
Please log in or sign up to comment.
Comments
Please log in or sign up to comment.