def led_on(value=1): """ Switch the proto shields LED :param value: 0/1 for off/on. Default is 1. :return: value :rtype : int """ GPIO.output(BOARD2.LED, value) return value
def reset(): """ manual reset :return: 0 """ GPIO.output(BOARD2.RST, 0) time.sleep(.01) GPIO.output(BOARD2.RST, 1) time.sleep(.01) return 0
def setup(): """ Configure the Raspberry GPIOs :rtype : None """ GPIO.setmode(GPIO.BCM) # LED GPIO.setup(BOARD.LED, GPIO.OUT) GPIO.setup(BOARD.RST, GPIO.OUT) GPIO.output(BOARD.LED, 0) GPIO.output(BOARD.RST, 1) # switch #GPIO.setup(BOARD.SWITCH, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) # DIOx for gpio_pin in [BOARD.DIO0, BOARD.DIO1, BOARD.DIO2, BOARD.DIO3]: GPIO.setup(gpio_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) # blink 2 times to signal the board is set up BOARD.blink(.1, 2)
def led_off(): """ Switch LED off :return: 0 """ GPIO.output(BOARD2.LED, 0) return 0