Hi Stephen,
- Install the git client: sudo apt install -y git
- Prepare GIT: git config --global user.name “John Doe” && git config --global user.email [email protected]
- Create a development directory and change into it: mkdir ~/Development && cd ~/Development
- Get the APA102 Library and sample light programs: git clone https://github.com/tinue/apa102-pi.git && cd apa102-pi
- cd apa102-pi && nano sample.py; Update as below, Ctrl-X and “Yes” to save. you can change any led and any color at strip.set_pixel_rgb(5, 0xFF0000).
#!/usr/bin/env python3
“”“Ultra simple sample on how to use the library”""
from driver import apa102
import time
from gpiozero import LED
power = LED(5)
power.on()
Initialize the library and the strip
strip = apa102.APA102(num_led=12, global_brightness=100, mosi = 10, sclk = 11,
order=‘rbg’)
Turn off all pixels (sometimes a few light up when the strip gets power)
strip.clear_strip()
Prepare a few individual pixels
strip.set_pixel_rgb(5, 0xFF0000) # Red
strip.set_pixel_rgb(6, 0xFFFFFF) # White
strip.set_pixel_rgb(8, 0x00FF00) # Green
print(“cc”)
Copy the buffer to the Strip (i.e. show the prepared pixels)
strip.show()
Wait a few Seconds, to check the result
time.sleep(1)
6.Run the sample lightshow: ./sample.py.