You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.
I am using a series of DS18B20 with a Pycom GPy, using this library with MicroPython 1.10. I need to create a OneWire connection with each one of them for identification purpose, not being able to control which sensor is connected in which Pin. Anyhow, the problem I found is that when the DS18X20 object is created, it only makes one scan(). It is sufficient most of the times, but sometimes it just don't find the attached device. So I suggest to recursively look for the attached device, maybe with a timeout, in order to not make an "start_conversion()" or "read_temp_async()" with an empty rom list, which breaks the program as it tries to access roms[0].
I managed to solve it locally editing the DS18X20 constructor like this:
def __init__(self, onewire):
self.ow = onewire
self.roms = []
self.fp = True
while self.roms == []:
print("scanning for roms...")
self.roms = [rom for rom in self.ow.scan() if rom[0] == 0x10 or rom[0] == 0x28]
try:
1/1
except TypeError:
self.fp = False # floatingpoint not supported
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I am using a series of DS18B20 with a Pycom GPy, using this library with MicroPython 1.10. I need to create a OneWire connection with each one of them for identification purpose, not being able to control which sensor is connected in which Pin. Anyhow, the problem I found is that when the DS18X20 object is created, it only makes one scan(). It is sufficient most of the times, but sometimes it just don't find the attached device. So I suggest to recursively look for the attached device, maybe with a timeout, in order to not make an "start_conversion()" or "read_temp_async()" with an empty rom list, which breaks the program as it tries to access roms[0].
I managed to solve it locally editing the DS18X20 constructor like this:
The text was updated successfully, but these errors were encountered: