Hi, this is my first post and I'm sad to introduce myself with a question. But I'd really appreciate an answer.
Well, I'm in a project and I was searching some info on the internet when I found this code: http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Components/LED/_7Seg_Example.pde
The thing is that I would love to know wich rules/relations/equations does this guy use to get the current average just with the amount of time that the led is on and off, in this part of the code:
//Display brightness
//Each digit is on for a certain amount of microseconds
//Then it is off until we have reached a total of 20ms for the function call
//Let's assume each digit is on for 1000us
//If each digit is on for 1ms, there are 4 digits, so the display is off for 16ms.
//That's a ratio of 1ms to 16ms or 6.25% on time (PWM).
//Let's define a variable called brightness that varies from:
//5000 blindingly bright (15.7mA current draw per digit)
//2000 shockingly bright (11.4mA current draw per digit)
//1000 pretty bright (5.9mA)
//500 normal (3mA)
//200 dim but readable (1.4mA)
//50 dim but readable (0.56mA)
//5 dim but readable (0.31mA)
//1 dim but readable in dark (0.28mA)
I wonder that this may be related to joule/second = w, but I'm not sure.
Thanks in advance.