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

    name 'ADC' is not defined

    Scheduled Pinned Locked Moved LoPy
    3 Posts 2 Posters 159 Views 2 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.
    • F Offline
      FabLab Vosges
      last edited by FabLab Vosges

      Hello all,
      ok, so, first of all : I'm new to all of this pycom programming cards...

      Secondly, I am having struggles making a card working.
      I do have a LoPy with an extension board, whom version is V2.1a.
      I did the updates on the boards, i'm working with Visual Studio Code with plugin Pymkr.

      Basically, i am just trying to get an analog info back from the pin16, where i have a moisture sensor plugged, a YL-69.

      Question is, as i was never able to find it on internet....

      Does anyone had bumped into the same issue? And if so, how can i manage to make that work? I'm kinda lost now guys...

      Anyway, thanks for your answers!

      Edit : I forgot to put my code... Here it is :

      import machine
      inPin = machine.ADC()
      pin16 = inPin.channel(pin='P16',attn=ADC.ATTN_11DB)
      print(pin16)

      robert-hhR 1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @FabLab Vosges
        last edited by robert-hh

        @FabLab-Vosges said in name 'ADC' is not defined:
        machine is missing. It has to be

        import machine
        inPin = machine.ADC()
        pin16 = inPin.channel(pin='P16',attn=machine.ADC.ATTN_11DB)
        print(pin16())
        
        1 Reply Last reply Reply Quote 0
        • F Offline
          FabLab Vosges
          last edited by

          Nice one!

          It is working, i didn't thought about that....
          Thanks!

          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