software PWM for individual LEDs?
Closed this issue · 3 comments
davidchatting commented
Hi - in theory would it be possible simulate PWM for individual LEDs by repeatably drawing to the display at a high rate and determining if this pixel should be on or off for this cycle?
I have been experimenting with code like this - but it runs much too slowly (like 100 times too slow):
c=canvas(device) #luma.core.render.canvas
for threshold in range(255,0,-1):
with c as display: #ImageDraw
for x in range(0, 16):
for y in range(0, 16):
if i[x][y]>=threshold:
drawPixel(x,y,display)
Any thoughts? Thanks!
David
rm-hull commented
It ought be possible, but I would be inclined to pre-render some 8x8px images with the bit patterns you want, and then blast through them in a loop... It would be a lot quicker than drawing onto a canvas with the nested loops
davidchatting commented
That's a good idea - let me try that!
thijstriemstra commented
any news @davidchatting?