Skip to content

A Python3 library that uses CLI commands instead of the normal wiringpi Python Libraries. Supports multiple colors and threading.

Notifications You must be signed in to change notification settings

ritchie-tg/Wiringpi-CLI-Blink-Library-Python-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Having issues with wiringpi ports for Python? You may use this library to get the GPIO functioning and blinking an LED. If you can run gpio readall from CLI, then this will work. Currently, the script features solid and blinking LED states. All the colors supported by an RGB LED. The blink function is threaded and doesn't interrupt the code flow.

Adjust self.pins = [225,229,231] in rgbled.py to you desired BCM pins for the LED. Place rgbled.py in the same directory as the script you want to use it with and import it. Requires sh.

python3 -m pip install sh
#ex:

from rgbled import rgbled
from time import sleep

led = rgbled()
led.setup()

led.blink('white', 0.2) #this won't stop until....

for i in range(10):
  print('running other code....')
  sleep(1)

led.blink('off', 0) #here by turning off the led.
led.blink('red', 0.2) #or here starting another thread to blink.
sleep(3)
led.write('magenta') #this is not threaded
sleep(3)
led.write('off')

led.blink('off', 0) #the blink red wouldn't stop until here

About

A Python3 library that uses CLI commands instead of the normal wiringpi Python Libraries. Supports multiple colors and threading.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages