Mote phat - clear() isn't clearing?

#1

Hi there

I’m using a Mote pHAT on a Pi0 to mirror some Hue-compatible bulbs in a room. My script polls the API on my Hue Hub to find out whether the bulbs are on and if so get their colour (then do some jiggery pokery with it) and show it on the Mote sticks.

If none of the bulbs are on, the script checks to see if they’ve only recently been turned off, via a boolean called wasOn - it goes like this (NB: motephat is imported as mote):

if wasOn == True:
    mote.clear()
    mote.show()
    wasOn = False

That worked perfectly on the iMac-connected Mote, but with the Mote pHAT I get some odd behaviour: the strips all turn off, but then the first pixel on channel 2 lights back up, pure white. I haven’t found any documented explanation for this, and I’ve tried a bunch of different things to fix it.

Can anyone point me in the right direction, so that all of the pixels will actually turn off? I’ve no doubt it’s going to be something simple and/or stupid that I’ve done or not done, but I’m past the point of being able to figure it out myself without tearing out chunks of hair!

Edited: to fix the indents, which were bugging me. Also, I’ve now tried literally everything I can think of. I created a new script that simply turns all LEDs on all four strips on, sleeps for ten seconds, then turns all of them off and sleeps for ten seconds - again, channel 2 pixel 1 goes off along with the others very briefly, then turns back on, bright white, for the rest of the ten seconds. I’m utterly baffled.

0 Likes

#3

Doh.

I was using an Official Pi PSU, so hadn’t considered it as a possible cause of the problem. Then I saw this and started to wonder. So I grabbed another, known-good PSU from one of my other Pis, plugged it in and my problem was gone: all the LEDs turn off and behave exactly as they should. A day of adding ever more complicated tests and verbose prints to my code, and all I ever needed was to try a different power supply.

I really should’ve known: if it isn’t the code, it’s always the PSU (or the shonky soldering), innit? So anyway, thanks for reading, no more need for help!

0 Likes