If this sounds like something that Picaxe is capable of doing, please let me know and I'll dig into refreshing my programming chops.
Yes, the PICAXE is perfectly capable of doing that. Getting it to ramp between two different duties will need some "ah, that's how one would do it" insight, which may be difficult to comprehend if it were simply thrown at you as a solution, but should be more understandable if built up from a simpler base.
I would suggest the best starting point, to get yourself up to speed, back into the flow of coding, is to forget PWM for now, and start with turning a LED on or off depending upon the switch position. We can replace the LED control with PWM control later.
My starting point would be -
Code:
#Picaxe 14M2
Do
If pinC.0 = 1 Then ; When switch closed ...
High B.5 ; Turn on the LED
Else ; Otherwise ...
Low B.5 ; Turn off the LED
End If
Pause 10 ; We don't need to run flat-out
Loop ; And repeat this loop forever
And then, because it's always good to not have to change hard-coded values throughout a program when you may want to use or try other I/O pins, I would specify those pins via SYMBOL statements -
Code:
#Picaxe 14M2
Symbol SWITCH_IN = pinC.0 ; Switch on input C.0
Symbol LED_OUT = B.5 ; LED on output B.5
Do
If SWITCH_IN = 1 Then ; When switch closed ...
High LED_OUT ; Turn on the LED
Else ; Otherwise ...
Low LED_OUT ; Turn off the LED
End If
Pause 10 ; We don't need to run flat-out
Loop ; And repeat this loop forever
And that's the fundamentals of what you need sorted. When the LED is on it will eventually be PWM output at one duty, when off it will be PWM output at the other duty.
If you run that in PICAXE Editor 6 simulation you will see output pin B.5 reflect the input pin C.0 state, and that will be toggled every time you click on the C.0 pin in the simulation panel, usually bottom left of PE6.
I would suggest the above alone will have got you 60% towards completing your project. Changing the LED output to be PWM is a fairly small step to get you to 80%. But as always with any '80:20', it's that final 20%, making PWM ramp from one duty to another, which requires most perspiration.
We can move on in further instalments or we can leave it for you to decide that you want to figure it out for yourself. Whichever you prefer, members here will always be happy to answer any questions you do have along the way.