Author Options:

what is the figure "65" in dimming code stands for and how does the di? Answered

I am having trouble understanding the following code, could you please help me out here?
firstly, in "int dimtime = (65*dimming)"
why is it 65? what does it stannd for?

Secondly, The "zero_crosss_int" function is triggered when AC input hits 0, so it is every 10ms(suppose 50Hz), right?
So,let's say dimming = 10, dimtime = 65*10=650, here is my understanding of the code :
delayMicroseconds(dimtime); // wait for 650μs, during whitch the lamp is off
digitalWrite(AC_LOAD, HIGH); // now, turn on the light
delayMicroseconds(10); // wait for 10μs, during whitch the lamp is on
digitalWrite(AC_LOAD, LOW); // now turn off the lamp.

If I'm right, in a 10ms cycle, the lamp only works for 10μs? that's like 1%, and the delytime only affects when the lamp lights up instead of how much time it does.
This does not make sense to me, could you please explain how it works more detailed?