Ramp up/down control

Hello world! :slight_smile:

I have one pot controling bulb brightness (Analog In, Out Serial) but I need another pot to control ramp up/down time between two pwm values. So when state of the POT 1 changes from 0 to 100%, pwm value ramps up to 100% in 10 seconds (when pot 2 is also at max value) and vice versa.
Thanks!

Share the code

sounds pretty simple... what do you need?

wolframore:
sounds pretty simple... what do you need?

Here is the working code so far

const int analogInPin = A2;  
const int analogOutPin = 6;

int sensorValue = 0;        
int outputValue = 0;        
void setup() {

 Serial.begin(9600);
}

void loop() {
 
 sensorValue = analogRead(analogInPin);

 outputValue = map(sensorValue, 0, 1023, 0, 255);

 analogWrite(analogOutPin, outputValue);

 delay(2);
}

Now I need another pot (A3) to control ramp up/down of PWM Pin 6. If POT2 (ramp pot) is at 100% and POT1 changes from 0 to 100% it would take 10 sec to ramp to that new value, If POT2 is at 100% and POT1 changes from 0 to 50% (for example) it would take 5 sec to ramp and so on.