control PWM duty cycle with input (hold input for time) Atm
Posted: Mon Jun 27, 2011 7:09 pm
Hi,
I made this little program,
I asked this in another thread but I wasnt abel to do this.
My problem is that I would like to change the PWM Signals when an Input (pushbutton is pressed) is done.
If switch "left" is pressed the left PWM (output left) should be around 30% duty cycle and hold for one second.
If switch "right" is pressed the right PWM (output right) should be around 30% duty cycle and hold for one second.
At the moment the duty cycle is only changed during the pushbutton is pressed. How can I change this the best way?
It must also work that when pshbutton left is pressed output left must change the duty cycle for one second, but when within 1 second bushbutto right is presses also the right must change the duty cycle for one second.
it sounds like multitasking for me and I dont know how to do this.
Another thing is I would like to activate the OC2 (third PWM) on my Atmega8. do I need to use a C Code for this?
Thanks
I made this little program,
I asked this in another thread but I wasnt abel to do this.
My problem is that I would like to change the PWM Signals when an Input (pushbutton is pressed) is done.
If switch "left" is pressed the left PWM (output left) should be around 30% duty cycle and hold for one second.
If switch "right" is pressed the right PWM (output right) should be around 30% duty cycle and hold for one second.
At the moment the duty cycle is only changed during the pushbutton is pressed. How can I change this the best way?
It must also work that when pshbutton left is pressed output left must change the duty cycle for one second, but when within 1 second bushbutto right is presses also the right must change the duty cycle for one second.
it sounds like multitasking for me and I dont know how to do this.
Another thing is I would like to activate the OC2 (third PWM) on my Atmega8. do I need to use a C Code for this?
Thanks