How to use the anyio.GPIO.setmode function in anyio

To help you get started, we’ve selected a few anyio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github whaleygeek / anyio / testSeg7.py View on Github external
# testSeg7.py - Test a 7-segment display

import anyio.seg7 as display
import time

# Use this for Raspberry Pi
#import RPi.GPIO as GPIO
#LED_PINS = [10,22,25,8,7,9,11,15]

# Use this for Arduino
import anyio.GPIO as GPIO
LED_PINS = [7,6,14,16,10,8,9,15]

GPIO.setmode(GPIO.BCM)

ON = False # common-anode. Set to True for a common cathode display

display.setup(GPIO, LED_PINS, ON)

try:
  while True:
    for d in range(10):
      display.write(str(d))
      time.sleep(0.5)
finally:
  GPIO.cleanup()
github whaleygeek / anyio / testHardware.py View on Github external
def setup():
  GPIO.setmode(GPIO.BCM)
  for l in LED_GPIO:
    GPIO.setup(l, GPIO.OUT)
    GPIO.output(l, False)

  for b in BUTTON_GPIO:
    GPIO.setup(b, GPIO.IN)