Python3, GPIO, Minidock & LED Blink
-
Just tested the GPIO using the minidock to blink an LED (with an integrated resistor on the anode). Used the code compiled by @Frederick Blais
Adapted it slightly to blink the LED connected to PIN 19.
Here's an example of the Python script:
(Just make sure to put the indents where they're needed as per Python standards)from subprocess import call from time import sleep RED = 19 PINS = (RED) HI = 0 LO = 1 def state(pin, state): if pin: call(["fast-gpio", "set", str(pin), state]) else: for pin in PINS: call(["fast-gpio", "set", str(pin), state]) def off(pin=None): state(pin, str(LO)) def on(pin=None): state(pin, str(HI)) def rotate(delay=0.05): while(True): off(RED) sleep(RED) on(RED) sleep(RED) def blink(pin, delay=0.5): while(True): on(pin) sleep(delay) off(pin) sleep(delay) if __name__=="__main__": off() #rotate() blink(RED)
-
Awesome!