Guys Im in over my head and need some assistance please!!
Following on from my LoPy4 adventures I now want to address two DS18x20 temperature sensors (air & soil temperatures), connected to the same GPIO.
I have done my best to follow the Pycom documentation and looking into the onewire.py library. The best I have got so far is this:
import time
from machine import Pin
from onewire import DS18X20
from onewire import OneWire
ow = OneWire(Pin(‘P10’))
temp = DS18X20(ow)
while True:
print(onewire.OneWire.scan(ow))
print(temp.read_temp_async())
time.sleep(1)
temp.start_conversion()
time.sleep(1)
Which gives the results:
[bytearray(b’(\xaa#\xf07\x14\x01g’), bytearray(b’(\x18/\x8e\t\x00\x001’)]
18.3125
So now I have the bytearray of the two ROMs but how do I get that last step completed such that I can update ow = OneWire(Pin(‘P10’)) to include the ROM address.
Or, as an alternative, how would I get both temperatures and be able to identify which temp came from which sensor??
Thanks
Jon









