Woks from Atom RUN but not when uploaded
-
Hi forum,
I'm new and I'm testing for a research project a monitoring solution based on LoPy. So fa I have added two DS18B20 to the LoPy + PySense. The strage things is that when i run the code from the Pymkr in Atom it correctly read the DS18B20 temperatures, but when I upload the code on the LoPy the reading is None.Doe anyone have any idea or similar experience? Where should I look to start debugging?
import time from lib.onewire import DS18X20 from lib.onewire import OneWire ow1 = OneWire(Pin('P4')) ow2 = OneWire(Pin('P8')) time.sleep(1) temp1 = DS18X20(ow1) temp2 = DS18X20(ow2) while True: print("T1:",temp1.read_temp_async(temp1.roms[0])) time.sleep(1) temp1.start_conversion() time.sleep(1) print("T2:", temp2.read_temp_async()) time.sleep(1) temp2.start_conversion() time.sleep(1) -
It looks like it needs a double scan to find the rom.
After inserting
ow1 = OneWire(Pin('P4')) print('found devices:', ow1.scan())Even if the print is an empty array ('found devices:[]') then the temperature reading is working with appropriate rom...
Anyone can get why?
Maxi
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login