Not sure this has been posted before (didn’t find it), there is a way to control GPIO with Python with sysfs-based gpio module:
- download GitHub - vitiral/gpio: python gpio module for linux using the sysfs file access (/sys/class/gpio). Mimics similar Raspberry Pi IO libraries release: gpio-1.0.0.zip
- copy it on the board
- unzip it
Note: you require more memory to run pip
, use the swap space guide posted here in this forum or create separate swapfile.
% cd gpio-1.0.0
% pip install .
% chmod +r /sys/class/gpio/export
then use this script blink.py
:
import time
import gpio as GPIO
pin = 440
GPIO.setup(pin, GPIO.OUT)
while True:
GPIO.output(pin, GPIO.HIGH)
time.sleep(1.0)
GPIO.output(pin, GPIO.LOW)
time.sleep(1.0)
and run it:
% python blink.py