name 'ADC' is not defined



  • 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)



  • Nice one!

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



  • @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())
    

Log in to reply
 

Pycom on Twitter