|
hi, i'm begginer in orange and i try to circuit 2 pins and check signal on end(1 or 0)I use orange pi lite, armbian, and orangepi_PC_gpio_pyH3, here code
- #!/usr/bin/env python
- from pyA20.gpio import gpio
- from pyA20.gpio import port
- from time import sleep
- print 'init gpio'
- gpio.init()
- #pin_out = port.PA10
- pin_in = port.PA11
- #gpio.setcfg(pin_out, gpio.OUTPUT)
- #gpio.setcfg(pin_in, gpio.OUTPUT)
- gpio.setcfg(pin_in, gpio.INPUT)
- #sleep(0.1)
- #gpio.pullup(pin_in, gpio.PULLDOWN)
- gpio.pullup(pin_in, gpio.PULLUP)
- #sleep(0.1)
- #gpio.output(pin_out, gpio.HIGH)
- print 'output high on pin %s' % str(pin_in)
- try:
- while True:
- state = gpio.input(pin_in)
- print str(state)
- #sleep(0.5)
- if state == 0:
- exit(0)
- except KeyboardInterrupt:
- #gpio.output(pin_out, gpio.LOW)
- print '\n exit'
Copy code i tried a lot of variants and its not working. i connect one end of wire to +3.3 and second end to p11.
In future it will be button counter. But now it simple task stunned me. Please help me)
|
|