WS2812B RGB LEDs With Retropie
-
Hello,
I am trying to install some WS2812B RGB LEDs onto my Retropie setup. I would like the RGBs maybe cycle some colors or something. I connected the strip and installed all of the libraries needed. I then proceeded to run the sample program according to this article. After successfully running the script and adding the code into a while true loop to keep script running, I added the code to the startup script. When the pi starts up, the script runs and the RGBs turn on. When I try to play a game, the game doesn't load. When I disable the LED strip, the game works fine. Does anyone know how to get the WS2812B RGB LED strip to work with Retropie.Here are the specifications of the system that I am using.
I am running Retropie on a raspberry pi 4.
The power supply is the standard raspberry pi plug.
I am using generic arcade controls from amazon with a button usb converter.
The tutorial that I used to set up the RGBs can be found Here
The video that I used to set up the script on startup can be found here
I am using Retropie flashed from the raspberry pi imager.Thanks
-
@PJ said in WS2812B RGB LEDs With Retropie:
When I try to play a game, the game doesn't load.
Post the output of
/dev/shm/runcommand.log
, it should contain the errors preventing the game from starting.
If you added your own code to the onstart/onend scripts, post the contents of those scripts also. -
Can't be of much help here, but I purchased three of these for my home.
https://www.amazon.com/gp/product/B08KXPRJ5D/
They're quite enjoyable, though the camera which needs to point at the television is a bit noticeable.
-
@mitu ```
This is really weird. Today, I tried again and the game started properly, but the cycle that I had programmed into the LED script did not continue past boot.
Here is the code that I added to the crontab file and used to run the program at startup.@reboot sudo python3 /home/pi/OneStripNeopixel.py &
Here is my modified version of the OneStripNeopixel.py from the tutorial that I used. I added the code into a while true loop and added a blinking sequence.
#include all neccessary packages to get LEDs to work with Raspberry Pi import time import board import neopixel import sys #Initialise a strips variable, provide the GPIO Data Pin #utilised and the amount of LED Nodes on strip and brightness (0 to 1 value) pixels1 = neopixel.NeoPixel(board.D12, 55, brightness=1) #Also create an arbitary count variable x=0 #color/pixel for cycle color = (0, 230, 191) pxel = 1 #Focusing on a particular strip, use the command Fill to make it all a single colour #based on decimal code R, G, B. Number can be anything from 255 - 0. Use a RGB Colour #Code Chart Website to quickly identify a desired fill colour. try: while True: pixels1.fill((0, 220, 0)) pixels1[pxel] = color if pxel == 30: pxel = 0 pxel = pxel + 1 #Below demonstrates how to individual address a colour to a LED Node, in this case #LED Node 10 and colour Blue was selected # pixels1[10] = (0, 20, 255) #Sleep for three seconds, You should now have all LEDs showing light with the first node #Showing a different colour time.sleep(0.3) except KeyboardInterrupt: pixels1.fill((0, 0, 0)) sys.exit() #Little Light slider script, it will produce a nice loading bar effect all the way up #and then all the way back #This was created using a While Loop taking advantage of that arbitary variable to determine #which LED Node we will taget/index with a different colour #Below will loop until variabe x has value 35 while x<35: pixels1[x] = (255, 0, 0) pixels1[x-5] = (255, 0, 100) pixels1[x-10] = (0, 0, 255) #Add 1 to the counter x=x+1 #Add a small time pause which will translate to 'smoothly' changing colour time.sleep(0.05) #below section is the same process as above loop just in reverse while x>-15: pixels1[x] = (255, 0, 0) pixels1[x+5] = (255, 0, 100) pixels1[x+10] = (0, 255, 0) x=x-1 time.sleep(0.05) #Add a brief time delay to appreciate what has happened time.sleep(4) #Complete the script by returning all the LED to off pixels1.fill((0, 0, 0))
When I tried to open the runcommand.log, it didn't exist. Could it be by another name?
Thanks!
-
When I tried to open the runcommand.log, it didn't exist. Could it be by another name?
No, there's only one name and location - as in my previous post. Note that
/dev/shm
is memory backed, so if you rebooted the Pi, the contents are gone. You need to open the log file just after you launched a game (and it failed) in order to see the exact error after the launch.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.