Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Having trouble programming gpio pin.
#1
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?
Reply
#2
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()
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)