Python Forum
Orange PI Win steering LEDs connect to GPIO - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/Forum-Python-Coding)
+--- Forum: General Coding Help (https://python-forum.io/Forum-General-Coding-Help)
+--- Thread: Orange PI Win steering LEDs connect to GPIO (/Thread-Orange-PI-Win-steering-LEDs-connect-to-GPIO)



Orange PI Win steering LEDs connect to GPIO - djmcg - Dec-27-2019

Hello
I have Orange PI Win and I would like to the 5 LEDs flash one after the other.
I was able to do it with the usual script below with colleagues help.:

#!/bin/bash

echo 37 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio37/direction
echo 38 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio38/direction
echo 39 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio39/direction
echo 101 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio101/direction
echo 36 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio36/direction

while true; do

#led1	
	echo 1 > /sys/class/gpio/gpio37/value
	sleep 0.25
	echo 0 > /sys/class/gpio/gpio37/value
	sleep 0.01
	
#Led2
	echo 1 > /sys/class/gpio/gpio38/value
	sleep 0.25
	echo 0 > /sys/class/gpio/gpio38/value
	sleep 0.01
	
# led3
	echo 1 > /sys/class/gpio/gpio39/value
	sleep 0.25
	echo 0 > /sys/class/gpio/gpio39/value
	sleep 0.01
	
#led4
	echo 1 > /sys/class/gpio/gpio101/value
	sleep 0.25
	echo 0 > /sys/class/gpio/gpio101/value
	sleep 0.01
#led5
	echo 1 > /sys/class/gpio/gpio36/value
	sleep 0.25
	echo 0 > /sys/class/gpio/gpio36/value
	sleep 0.01
done
But I would like to achieve the same effect written in python.
There are a few other ways to do this, but all the tutorials what I have found on the web are pi raspberry and not my OPI
I work on Armbian and use Geany
Could You advice how to do that?