Mon, 2012-01-30 23:07 — KiberGus
At least I've managed to catch sneaky bug in light control firmware. When brightness was set to low bulb periodically flushed. I has been hunting it for last two weeks. Actually, there were several bugs, that's because I'm not used to writing hard realtime applications. For example only yesterday I've understood that main loop shouldn't work as fast as it can, it should work as evenly as it can and it's start must be synchronized with alternation of current in power network. And today I've found out that zero cross detector triggers at different moment of time and additional software averaging is needed. If I was better at electronics I would probably made a better one and I wouldn't need complex zero cross prediction code. A week ago I've understood that instead of synchronizing two timers I can stop using built in arduino functions and use one timer.
But I'm quite glad at overall. Microcontroller programming is fun.
update: Some time after I've found timer interrupts and had to rewrite firmware in proper way.