Reputation: 11
I was working with gpiozero
and wanted to use the MockFactory
to debug on a local device without Raspberry Pi (4) connection. The last time I used the Mockfactory
was with an gpiozero.LED
object. But this time I used a gpiozero.RGBLED
output device. When I run my Programm I get the following error:
gpiozero.exc.PinPWMUnsupported
import gpiozero
from gpiozero.pins.mock import MockFactory
gpiozero.Device.pin_factory = MockFactory()
led = gpiozero.RGBLED(4, 3, 2)
I know that the MockFactory
does not support PWM as stated in the documentation https://github.com/gpiozero/gpiozero/blob/master/gpiozero/pins/mock.py
A mock pin used primarily for testing. This class does not support PWM.
How would I implement this functionality in order to test my programm without a connection to the Raspberry Pi? Any help or pointers in the right direction are greatly appriciated!
Upvotes: 1
Views: 350
Reputation: 82
As RGBs are inherently PWM (the amount of red, green and blue is controlled with PWM), this won't work.
What you could do is just create some dummy output based on the values you want. You didn't write your intention, but you could make the values you'd want your RGBLED to have, and just print them for debugging.
Let me know if you want any other tips!
Upvotes: 1