4-mic Array LED Control Lessons

Hello,



I have the 4-Mic Array with 12 circular LED’s on top. It is on a Raspberry Pi 3B+ and working fine. In fact it is a great little device.



My problem is that I am really struggling with fully understanding how to control the LED patterns. I have been through the demo files (which all work fine) very slowly several times and I am still having a hard time with it. I would like to generate my own patterns and colors, but I just can’t seem to get a grip here. I have taken several online Python courses and have a strong basic understanding of the code, I just can’t seem to figure out the correct way to do this.



If there is anyone out there willing to give me a lesson or point me to a “for dummies” resource I would really appreciate the help.



Thanks,

Stephan

Hi Stephen



Please take look at https://github.com/respeaker/pixel_ring, the pixel library. thanks.

OK, went through that and it is the same issue. A .py file that calls another one that calls another one until I am confused as hell.



Let’s make it simple. Can anyone tell me how to change the blue to any other color in the Alexa or Echo pattern?



Thanks,

Stephan

Hi Stephen,


  1. Install the git client: sudo apt install -y git
  2. Prepare GIT: git config --global user.name “John Doe” && git config --global user.email johndoe@example.com
  3. Create a development directory and change into it: mkdir ~/Development && cd ~/Development
  4. Get the APA102 Library and sample light programs: git clone https://github.com/tinue/apa102-pi.git && cd apa102-pi
  5. 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.