Onewire library function does not work



  • Hi everyone! I am trying to read temperature values using a DS18x20 sensor and a 1-Wire. Thus I use both libraries which you can find here : https://github.com/pycom/pycom-libraries/blob/master/examples/DS18X20/onewire.py. However, the read_temp_async function keeps returning None as a result. Following the indication on the link, it says that this is due to the fact that the convertion is not completed but still, I do not understand why this is happening. I do not know if this is due to the code (which you can find down there and is very simple) or to the electronic circuit I made (which includes a Pycom device connected to the computer through a USB cable and this device is also connected to a breadboard containing the sensor). Thanks for helping

    ow=OneWire(Pin('G5'))
    r=DS18x20(ow)
    print(r.read_temp_async())



  • @brossingo G5 is an input only pin, like G4, G0, G3, G31 and G30. Try another pin, like G22 or G17 or G7 or G6 or ....


 

Hello World?

Pylife on Kickstarter - November 2018








Back Us On Kickstarter >

Pycom on Twitter