Propeller hat expansion


I’m looking to use the proleller 30 pin as PWM.
I’m getting a bit confused on how to get it working, I followed and doing something like this

$ python -im p1.pwm
Setting up Propeller HAT
Connected (version=1)
Sending code (2968 bytes)
>>> p1.pwm.duty(0, 50, 20000)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'pwm'

this because the pwm function doesn’t exist.

>>> dir(p1)
['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'loader']

What I’m doing wrong?


Try to lauch the python interactive shell first, then import p1.pwm. Worked for me.


Thank you Rogue it works!!!