potentiometer's to control awsomness!

i have an idea, and it'll be awsome!! heres what the situation is: we have 2 potentiometers, and 3 leds (RGB) and a 7 segment display. so we could do this: we can use one potentiometer to control the mode ( either mode 1:led 1, mode 2:led 2, or mode 3:led3 ) and use the second potentiometer to controll the brightness of each led, and put em all in pwm obviously. And use the 7 segment display to tell us what mode were in.

so we turn one potentiometer, and itll tell us which led were controling, and then we use the second potentiometer to tell us the birghtness of the led's, and the mode is displayed on the 7 segment display. but i need somebody who can code this up for me, cuz i think i can only code the 7 seg display, so any one up for the challenge?? thanks in advance! -big93

Here is fragment to select the led that can get you started:

#define POT_PIN 1 // the analog pin that the post is connected to
#define NBR_OF_MODES 3 // the number of leds

int potvalue = analogRead(POT_PIN); // read the pot position
int mode = potvalue /(1024 / NBR_OF_MODES); // divide 1024 max pot value by number of modes

in this example, mode will range between 0 to 2 as the pot is rotated:

this gives me 3 modes right?

0, 1, 2?

cuz if thats the code for mode changing, i think i might be able to code the rest myself, wait except brightness, and controlling it with the potentiometer... can u code that also please? thanks mem! big93

Have a read about analogWrite() and see the 'fading led ' example sketch in the IDE.

All you should need to do is divide the value returned from the pot (max 1024) by 4 and feed it into analogWrite. Have fun!

lol sorry but i gotta throw a noob question at you.... whats IDE?

sorry, uve been telling me to go there for a while and i'm like "hmm, maybe its the tut section? "

IDE: Integrated Development Environment. It is the program called arduino.exe that you run to create and compile sketches. In the main menu, see File ->Sketchbook->Examples->Analog->Fading

aha, thats what it is, ok i see it, ill look at it and try to copy the code into mine, thanks!