# arduino 0-5v input

Maybe – and it came to me because my friend asked me to he – wants to sell LEDs in the interior of his car and take out the old bulbs and he wanted blue. So I figured why not allow them to have every single color. So we got some of these red green blue LEDs. They have all three colors in them and we made this circuit that allows you to control the mixture of color, so you can get any color in the color spectrum, so here I’m gon na fart on the top. Here we have the red circuit or the red LED circuit, and we used two resistors here, because we were too lazy to find one that was the same size as these two I think they’re, like I don’t know, and then here we’re using these be JT’s. Here are switches, they’re, pretty small, I know, but that was just for a prototype will probably make them bigger later and they’re npn for sure, then we have these current, limiting resistor Zahn the BJT s just because we like to be safe and awesome, and this capacitor Is where the power is drawn? Well, it’s in parallel to where the power is drawn and it kind of serves as a low pass filter to limit the current or two to equalize any ripple going through the circuit. This potential owner has used to control the color of the LED, which is something I’m, not quite sure, I’ve, seen in any of the videos online, so that’s.

What I think might make this a little special it’s, not very hard, I’m sure a lot of people could do it. In fact, they probably have and then here’s a microcontroller that we using it’s an Arduino 28 pin hunk of Awesomeness. Ok, so here we go. We’Ll put this on to diffuse the light I’m gon na put two of these in here, which is probably not kosher, but I mean it’ll work so that we’ll just serve as a light diffuser, so you don’t all go blind. So here we have white. We kind of added white is a clause in our code, because white is pretty hard to obtain in the color spectrum and so give away. And then you start turning it and you get blue and it starts to slowly turn to green and then yellow through orange and to read and then through purple and that to blue, and you can go back through that and get back to what. If you turn this a little too much, obviously you’ve seen it there’s like a little blue flash when you hit the end of the wiper, I don’t know what the deal is with that will work on it, but no actually I think I’m.

# arduino 0-5v input Social

official.arduino
2019-10-02T19:32:52+0000

👋 Want to bring Tony Stark-like gesture control to your projects? Learn how with the BLE-enabled MKR WiFi 1010 and Nano 33 BLE Sense boards using the ArduinoBLE library.
official.arduino
2019-10-02T19:08:01+0000

Arduin-yo ho ho! A fairground favorite, the pirate ship is a fun way to explore the oscillation of a pendulum. How much fun, you ask? Access our Science Kit Physics Lab preview and see for yourself: http://bit.ly/2oC6L0Q

🔬 Now that you’ve gotten your feet wet, dive into the kit and enjoy all nine experiments. Order yours today: http://bit.ly/2MnQ7fr

Originally posted 2016-07-31 10:21:48.

(Visited 53 times, 1 visits today)

## Comment (4)

1. François Cooper says:

hi, i’m currently working on a small project and i tried to write the code for the same circuit, could you please post the code. thx!

2. RC Breakers says:

/*
* Code for making one potentiometer control 3 LEDs, red, grn and blu, or one tri-color LED
* The program cross-fades from red to grn, grn to blu, and blu to red
* Clay Shirky
*/

// INPUT: Potentiometer should be connected to 5V and GND
int potPin = 3; // Potentiometer output connected to analog pin 3
int potVal = 0; // Variable to store the input from the potentiometer

// OUTPUT: Use digital pins 9-11, the Pulse-width Modulation (PWM) pins
// LED’s cathodes should be connected to digital GND
int redPin = 9; // Red LED, connected to digital pin 9
int grnPin = 10; // Green LED, connected to digital pin 10
int bluPin = 11; // Blue LED, connected to digital pin 11

// Program variables
int redVal = 0; // Variables to store the values to send to the pins
int grnVal = 0;
int bluVal = 0;

void setup()
{
pinMode(redPin, OUTPUT); // sets the pins as output
pinMode(grnPin, OUTPUT);
pinMode(bluPin, OUTPUT);
}

// Main program
void loop()
{
potVal = analogRead(potPin); // read the potentiometer value at the input pin

if (potVal < 341) // Lowest third of the potentiometer's range (0-340) { potVal = (potVal * 3) / 4; // Normalize to 0-255 redVal = 256 - potVal; // Red from full to off grnVal = potVal; // Green from off to full bluVal = 1; // Blue off } else if (potVal < 682) // Middle third of potentiometer's range (341-681) { potVal = ( (potVal-341) * 3) / 4; // Normalize to 0-255 redVal = 1; // Red off grnVal = 256 - potVal; // Green from full to off bluVal = potVal; // Blue from off to full } else // Upper third of potentiometer"s range (682-1023) { potVal = ( (potVal-683) * 3) / 4; // Normalize to 0-255 redVal = potVal; // Red from off to full grnVal = 1; // Green off bluVal = 256 - potVal; // Blue from full to off } analogWrite(redPin, redVal); // Write values to LED pins analogWrite(grnPin, grnVal); analogWrite(bluPin, bluVal); }

1. RC Breakers says:

And here is the (dim blue) fix.. i made it white for you 😉

/*
* Code for making one potentiometer control 3 LEDs, red, grn and blu, or one tri-color LED
* The program cross-fades from red to grn, grn to blu, and blu to red
* Clay Shirky
*/

// INPUT: Potentiometer should be connected to 5V and GND
int potPin = 3; // Potentiometer output connected to analog pin 3
int potVal = 0; // Variable to store the input from the potentiometer

// OUTPUT: Use digital pins 9-11, the Pulse-width Modulation (PWM) pins
// LED’s cathodes should be connected to digital GND
int redPin = 9; // Red LED, connected to digital pin 9
int grnPin = 10; // Green LED, connected to digital pin 10
int bluPin = 11; // Blue LED, connected to digital pin 11

// Program variables
int redVal = 0; // Variables to store the values to send to the pins
int grnVal = 0;
int bluVal = 0;

void setup()
{
pinMode(redPin, OUTPUT); // sets the pins as output
pinMode(grnPin, OUTPUT);
pinMode(bluPin, OUTPUT);
}

// Main program
void loop()
{
potVal = analogRead(potPin); // read the potentiometer value at the input pin
if (potVal < 10) // Lowest third of the potentiometer's range (0-340) { potVal = (potVal * 3) / 4; redVal = 255; grnVal = 255; bluVal = 255; } else if (potVal < 341) { potVal = (potVal * 3) / 4; // Normalize to 0-255 redVal = 256 - potVal; // Red from full to off grnVal = potVal; // Green from off to full bluVal = 1; // Blue off } else if (potVal < 682) // Middle third of potentiometer's range (341-681) { potVal = ( (potVal-341) * 3) / 4; // Normalize to 0-255 redVal = 1; // Red off grnVal = 256 - potVal; // Green from full to off bluVal = potVal; // Blue from off to full } else // Upper third of potentiometer"s range (682-1023) { potVal = ( (potVal-683) * 3) / 4; // Normalize to 0-255 redVal = potVal; // Red from off to full grnVal = 1; // Green off bluVal = 255 - potVal; // Blue from full to off } analogWrite(redPin, redVal); // Write values to LED pins analogWrite(grnPin, grnVal); analogWrite(bluPin, bluVal); }

3. Nico Andy Setiawan says:

skema