Go Down

Topic: Softpot Rotary Potentiometer to change the color of your LED's (Read 43 times) previous topic - next topic

desiree

Hello there,

I have bought a Softpot Rotary Potentiometer of SpectraSymbol, that I want to use for changing the color of the LEDs I'm using for my graduation project. I'm really bad in coding so I wanted to ask your for help. You would be my hero of the day! :smiley-wink:


This code,  comes from http://bildr.org/ but when you let go the sensor it goes back to it's original resistance. The thing I need, is that when you touch it, it will stay at that number of resistance so this can be linked to the RGB code, so you can actually choose your color.



int softpotPin = A0; //analog pin 0

void setup(){
  digitalWrite(softpotPin, HIGH); //enable pullup resistor
  Serial.begin(9600);
}

void loop(){
  int softpotReading = analogRead(softpotPin);



So first: How can it stay at the same resistance code?
Second: How does the code look like when a resistance number is linked to a specific RGB color.

(one example will do, just to get the idea)

I really hope somebody can help me out.
Thank you very much in advance!

Best,

Desiree

Student Design Academy Eindhoven

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy