Control white LEDs on PAA5100JE?

I don’t see any function in the Python support library for the PMW3901 or PAA5100JE to control the white LEDs. They turn on automatically when the sensor is activated but I’d like to be able to turn them back off again when I’m not using the sensor. I’m assuming this can be done via writing to the sensor’s registers, but there’s nothing I can find in the library as a clue.

Any help much appreciated, thanks!

see How do I turn on the LEDs? · Issue #4 · pimoroni/pmw3901-python · GitHub

Thanks very much for your help! I can confirm that the suggested solution works. Here’s an addition to the PWM3901 class that would turn the white LEDs on or off:

    def set_illumination(self, value):
        '''
        Turns the sensor illumination (white LEDs) on or off.
        '''
        if value is True:
            time.sleep(0.2)
            self._write(0x7f, 0x14) 
            self._write(0x6f, 0x1c) # DEC 28
            self._write(0x7f, 0x00)
        else:
            time.sleep(0.2)
            self._write(0x7f, 0x14)
            self._write(0x6f, 0x00)
            self._write(0x7f, 0x00)

I added a link to your post to the issue (which is closed, no idea why). I am not using this, but you might create a pull-request to the repo with your code. It is always better to have it in the library than to maintain it separately.

I’m not sure how to interpret “I am not using this”, i.e., you don’t think this is necessary in the repo? So I’m a bit confused about your suggestion of me creating a PR. I can create a PR if you want to add the method.

I posted it thinking that other people might benefit from having it in the library proper as I’d guess wanting to have control of the white LEDs might be fairly common. I myself don’t actually need it since I can call _write() directly, so set_illumination() would be a convenience method.

Your call. Sorry for any confusion.

“I am not using this” device. So I can’t create and test a PR, that’s why I asked you to do that. Just posting it here will be of no help in a couple of days for other users, because not everyone using the device will also be using this forum (and the forum search engine is of no help either).

Ah, thanks for clearing that up. Understood.