How to use a soft potentiometer with an RGB led

The basic idea is an RGB Led lamp, controlled with a circular soft potentiometer, which is to work as a color selection wheel. Everything is working fine, but the main problem is that when I select a color on the potentiometer and then LET GO, it resets to the default input for the pot. How can I do this so that when i do not touch the pot, it stays on the value that i was touching last?

A few ideas I had already: 1. make some sort of switch under the pot that would react to the weight of your finger 2. make a separate button that you have to hold down to select a color, and then let go of the button before you let go of the pot :/

These ideas would be pretty cluncky though

Can you set the default for the pot? If so, set it to the new current value each time the pot is moved.

To detect when a soft pot is being touched you need to be a bit clever. In place of wiring the two ends to power and ground you wire them to two digital output pins. Before you take the reading you first put both outputs low and take a reading, then you put them both high and take a reading. If those two readings are not zero and 1023 then the pot is not being pressed so don't change the light. If those two readings are that you then put one output high and the other low and take a reading to change the light.

I would simply update the light colour whenever there is a change in the reading, if the reading isn't flickering like a LDR.

I would simply update the light colour whenever there is a change in the reading

That won’t work because you have no way to distinguish between a read leading and one caused by random pickup from an effectively unconnected input.

yes, part of the problem is that I cant simply take a "normally unpressed" reading, because that seems to be changing every time I press it.

@ Grumpy_Mike That seems like a good idea, but im not sure I understand how this works. So the three contacts that are connected to analog 0, 5V and ground would be connected to analog 0, some digital and some other digital? Wouldnt I need a ground for these digital pins? Also I dont see how you would get any reading from setting the digital pins to high and low, since the analog pin isnt technically connected to the circuit unless it is pressed down.

If I cant get the pot to sense whether it is being touched or not, what ill do is have some sort of a "preview button" that uses a separate backlit RGB led to show the direct analog input, even when unpressed. When you choose the color you want, you press the preview button and it sends that value to the rest of the leds

So the three contacts that are connected to analog 0, 5V and ground would be connected to analog 0, some digital and some other digital?

Yes.

Wouldnt I need a ground for these digital pins?

No.

Also I dont see how you would get any reading from setting the digital pins to high and low, since the analog pin isnt technically connected to the circuit unless it is pressed down.

That is the whole point. If there is nothing connected to the analogue input then it floats. This means it picks up interference and can be any value between 0 and 1023. If it is connected it will get 0 and 1203 with the two states of digital pins so you know it is pushed and you can then take a reading with one pin high and the other low, anything else and you know it isn't pushed and you don't bother reading it.

This is the basis of my recent project:- http://arduino.cc/forum/index.php/topic,96588.0.html

add note to this

To use Connect one side pin to ground via a 10K resistor in series. Connect the other side pin to your Vcc power line (3V, 5V etc) via a different 10K resistor in series. Then read the analog voltage on the center pin. It will range from 1/3 Vcc to 2/3 Vcc . Do not connect to Ground and Power directly!

When no pressure is applied, the middle pin floats, so be sure to use some sort of weak pullup, such as 100K ohm.

note taken from adafruit

Here's an idea:

Add a weak (100K) pull-up to the analog pin. Put a small resistor (1K?) between the pot and +5. If the analog input is 1023 there is no press and you are reading the pull-up. Otherwise the input ranges from 0 to about 91% full scale.