Problems with Pin class



  • Hi.

    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?

    Thanks


  • Global Moderator

    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.


  • Global Moderator

    The possibility to use alternate functions for Pins has not been implemented yet.

    You could try without the alt=-1 part.


Log in to reply
 

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.