Pots Programming in Processing

Working on a program with three pots. Pots work fine, getting their values works fine. Dividing values by 4 to get variable values 0-255.

I have a prototype program that works fine using key presses. These key presses set a minRed and maxRed color:

if(key == 'a') { minRed = 0; maxRed= 60; }

which is later used to choose a randomized red color in that range as in:

redValue = int (random (minRed, maxRed));

This all works great.

I want to do the same thing but with pots rather than key presses. When I use the pots, I know I am getting continuously changing values from the sensor, so it doesn't act like a one-time act, like a key press.

Is there a way to take in the sensors' values and treat them as though they were key presses--some way to filter the sensor output to act like a switch?

Thanks,

George

Is there a way to take in the sensors' values and treat them as though they were key presses--some way to filter the sensor output to act like a switch?

How does Processing decide when to tell the Arduino of a change in value?

Implement that same logic on the Arduino to read the pot values.