LoBo Forums

Full Version: Having trouble programming gpio pin.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,  I am new to micropython,  and have been following the micropython documentation. 
I am testing gpio pin but keep getting error message.
 
I type:
pyb.Pin     and get     

I then type:
p_out = Pin('X1',  Pin. OUT_PP)      and get the below error message. 

Trace back (most recent call last) :
    Five "",  line 1, in
NameError: name  'Pin' is not defined

Is anyone able to tell me where I am going wrong?
When you open a new thread it tries to explain you in the most complete way, I don't know what hardware you have or what code you used, it's hard to say what's your problem right now but "Pin" is not defined so you probably miss the import.

https://github.com/loboris/MicroPython_E...o/wiki/pin



from machine import Pin

pinout = Pin(0, Pin.OUT)
pinout.value(1)

pinin = Pin(2, Pin.IN)
val = pinin.value()