For a project I need to brighten up a LED on an STK500 board via PWM. I am working with an ATMEGA32A and write the code in C (AtmelStudio 6.2). I have been doing quite a bit of research (i.e. spending hours and hours on forums and in the datasheet).
This is what I found out/came up with so far:
- the LED that is an output for PWM is OC0=PB3
- I chose to put the register TCCR0 on fast PWM, non inverted, no prescaler
- the trigger to start the PWM cycle is pressing switch 0 (this is part of the project, I have to set a trigger (alarm) to start the cycle)
- when I set OCR0 = 0 that means PWM = 0. so when I set OC0 = 115 that would be a PWM of 45% (of 255), right? I need to add 'value' to OCR0 in order to make the LED shine brighter and brighter each clockcycle, I used a for-loop for that
When I build the code in Atmel Studio it does not give an error (hurray for me
, but when I flash it to the STK500 nothing happens with the LED when I press switch 0
I'll try to attach my code. Can someone give me some advice on this?
Thanks in advance!