Problems with Pin class
alfheim last edited by
I'm trying to modify the DHT22 class (https://github.com/kurik/uPython-DHT22) to work on WiPy2
No matter what I try to put in line 37:
nc = Pin(nc_pin, mode=Pin.OPEN_DRAIN, pull=None, alt=-1)
The result is always:
Traceback (most recent call last):
File "<stdin>", line 13, in <module>
File "/flash/lib/dht/DHT22.py", line 37, in init
ValueError: invalid argument(s) value
This is my code to use the class:
from dht import DHT22
DHT22.init(nc_pin=5, gnd_pin = 'GND', vcc_pin='3V3 OUT', data_pin=6)
Another question: the original DHT22 class want to know the GND and 3V3 pin: how are they mapped in machine library?
I've had a look at the code... Timers are not yet implemented so this code will not yet work. Also your init should use correct pin names, example: 'P5', 'P6' etc.
The possibility to use alternate functions for Pins has not been implemented yet.
You could try without the alt=-1 part.