Push Button Activated While Loop

Hi guys and gals

I've a really simple problem that I just cannot seem to get my head around !

I'm looking for a sketch that :

On startup gives a PWM output of 50

On the push of a button (rising edge) the PWM output rises at a definable rate to 255

Then after a set time or the button is released the PWM value drops at the same rate as before down to 50

That's literally it and I just can't work it out ! - major mind block happening right now !

Any help would be greatly appreciated :slight_smile:

Sam