Hi, I have a new zero with the mote phat attached, 4 motes and cables. I have found that after setting the pixels (using the examples provided) and issuing the show, not all pixels are lighting. (8,16,16,8). If I then rerun the show command again they all show. This is consistent. Has anyone seen this and got any ideas as to why it might be happening ? I am using a power block rated at 3.4amps.
#code taken from motephat examples
import colorsys
import motephat
import time
offset = 0
for channel in range(4):
for pixel in range(16):
hue = offset + (10 * (channel * 16) + pixel)
hue %= 360
hue /= 360.0
r, g, b = [int(c*255) for c in colorsys.hsv_to_rgb(hue, 1.0, 1.0)]
motephat.set_pixel(channel+1, pixel, r, g, b)
print(channel+1,pixel,r,g,b)
motephat.show()
#only partial display of the set pixels
#8,16,8,16
time.sleep(1)
#sleep to see the missing pixels
motephat.show()
#all pixels now displayed
time.sleep(2)
#sleep to see the shown pixels
#repeat to show that it always requires the 2 shows to show all pixel set changes
offset += 1
for channel in range(4):
for pixel in range(16):
hue = offset + (10 * (channel * 16) + pixel)
hue %= 360
hue /= 360.0
r, g, b = [int(c*255) for c in colorsys.hsv_to_rgb(hue, 1.0, 1.0)]
motephat.set_pixel(channel+1, pixel, g,r, b)
print(channel+1,pixel,r,g,b)
motephat.show()
time.sleep(2)
motephat.show()
time.sleep(2)
#output:
this is not a correction to the behaviour but a poor workaround that may help:
always use 2 * show() in your code - which will slow down the process,
compile the base motephat library using cython, this will run *2 faster than raw python , so you end up back where you where but at least all LEDs are correctly lighting
I’ve been running some tests using the code posted here and my own code, but haven’t managed to recreate the problem yet. I know it’s possible, since we’ve observed similar results before which is what prompted @sandyjmacdonald to write this article: http://blog.pimoroni.com/apa102-variants/
It may be that you have sticks that are using a slightly different part to the ones I have available to test with, and they need slightly more bits clocked out to properly flush the data through the chain.
The _eof() function is the pixel “end of frame” and is just twiddling the clock pin enough times to clock all the pixel data through each pixel and to the end of the 16-pixel chains on each Mote bus.
You can install the library from the “library” folder with sudo ./setup.py install
I have just recreated this issue myself using the simple mote.set_all(colour[0], colour[1], colour[2], brightness=brightness). If colour[1] is <= 128 then it sets the red colour correctly. If >128, then only the first half of the strips are set. I suspect this is something to do with the repurposing of blinkt code to mote. May be wrong.