I put together a simple PWM-based fading routine for the LEDs; it's pretty much a pair of functions that run as fast as possible:
updateLEDs(unsigned char ledOutput1, unsigned char ledOutput2)
...updates the current LED state (i.e., on or off), and...displayFader()....iterates through a counter to decide whether to turn the LEDs on or off at a given time.
I'm guessing the code could probably be significantly more efficient; I'm still learning a lot about how bitwise operations work and so forth, so comments are absolutely welcome and encouraged. I also added a slower loop to gradually change the LED brightness values sequentially.
When I used the full 8-bit brightness value for each LED, I was able to maintain a ~40 Hz refresh rate according to the 'scope; this produced noticeable flicker, so I reduced the threshold for faderCount to 100. I'd like more rangeability as brightness level 1 still isn't super dim, but it's a start.
Firmware update has been pushed to the repo.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
[this comment has been deleted]
Thanks!! The current model is fairly delicate.. the new boards arrived yesterday and proper footprints should help that out a lot.
Are you sure? yes | no