Software > Software

software pwm


can just somebody explain how i can calculate the period that a led needs to be off and on at lets say 3.69mhz (or use something else but mention it  :D)

my goal is to build a function that you give a % and then the led is burning at that %

//------------ old topic -------------\\
does anyone of you people at societyofrobots know how to make an software PWM for fading a LED

my microcontroller runs at 4khz (i think this is the most easy frequency)

-> i know its something like 1micro seconde on and 3 microseconds off etc

Steve Joblin:
If you tell us what microcontroller you are using and what language you are programming it in, I am sure we can help you.

ow woops im srry

i use C

atmega16L programmed with the stk500 board

Steve Joblin:
This was designed for PICs, but it may work for Atmegas as well...

If you have your LED off for 3us and on for 1us, that means your LED will only be 1us/(1us+3us) = 25% bright.


[0] Message Index

Go to full version