Read from A0 and write to PWM pin

hello,

Can Someone help me with this problem ?

Arduino read a photoresistor on pin A0 and send it to a PWM pin. When I press a button, last A0 reading need to freeze on that PWM pin. When I release button everything back to normal

Sorry cannot link for some reason on mobile.

Research - "mapping"
It will convert your analog input to a useable range for pwm

Research - "analog.write()"
It is kind of misleading. It writes the digital pwm signal to a digital pin

Research - "switch state change"
It will explain how to use switches as you need.

@meccip, how can we know what you are doing when you hve not posted your code?

And when posting code please use the code button </>so your code looks like thisand is easy to copy to a text editor See How to use the Forum

...R