Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Woks from Atom RUN but not when uploaded

    Scheduled Pinned Locked Moved Discussion
    ds18b20pymakrpysense
    2 Posts 1 Posters 667 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      maxi
      last edited by

      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)
      
      1 Reply Last reply Reply Quote 0
      • M Offline
        maxi
        last edited by

        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

        1 Reply Last reply Reply Quote 0

        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
        • 1 / 1
        • First post
          Last post

        Pycom on Twitter

        Pycom