View: 4953|Reply: 0

Orange pi lite 2 pins circuit

[Copy link]

1

threads

1

posts

21

credits

Novice

Rank: 1

credits
21
Published in 2017-8-4 21:02:06 | Show all floors |Read mode
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
  1. #!/usr/bin/env python
  2. from pyA20.gpio import gpio
  3. from pyA20.gpio import port
  4. from time import sleep

  5. print 'init gpio'
  6. gpio.init()

  7. #pin_out = port.PA10
  8. pin_in = port.PA11

  9. #gpio.setcfg(pin_out, gpio.OUTPUT)
  10. #gpio.setcfg(pin_in, gpio.OUTPUT)
  11. gpio.setcfg(pin_in, gpio.INPUT)
  12. #sleep(0.1)

  13. #gpio.pullup(pin_in, gpio.PULLDOWN)
  14. gpio.pullup(pin_in, gpio.PULLUP)
  15. #sleep(0.1)

  16. #gpio.output(pin_out, gpio.HIGH)
  17. print 'output high on pin %s' % str(pin_in)
  18. try:
  19.     while True:
  20.         state = gpio.input(pin_in)
  21.         print str(state)
  22.         #sleep(0.5)
  23.         if  state == 0:
  24.             exit(0)
  25. except KeyboardInterrupt:
  26.     #gpio.output(pin_out, gpio.LOW)
  27.     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)
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list