Python Forum
Python with LED light strip question.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python with LED light strip question.
#1
I recently took up a project to try to mimic a game I saw in my childhood science center. It was a game where you could hit a button and have to race an animal via lit up bulbs that would light up down a long hallway and you’d basically have to beat the lights down the hallway by racing them. I’m newer to python and I’ve only been coding for about a year or two. I already have the game set up but I’m debating on what light strips to get(cost effective) that would be easiest to code with python. Also I haven’t coded the sunning of the light strips(because I don’t have them) All I want them to be able to do is when a button is clicked(on screen) pause for about 3 seconds.(3-2-1-go) then have one led light up down the whole strip to the end. Then I’ll also try my hand at having them all light up once it reaches the end. I’m between the SMD5050, SMD3528, or WS281x. Do they all require the same code or is one harder than the other?
Reply
#2
This sounds great but Python alone isn't going to do it for you. Although, you can ultimately use Python to code your logic you need some type of peripheral device that will be able to control the voltage going in and out of the LED strip. If you want to use Python (not necessary btw) but if you do you can buy a rasberry pi and use the RPi library for Python.

All that being said if you are interested in this working in real time then Python is not the way you want to go. This is because you will never be able to predict when Python say... goes garbage collecting or something like that which will ultimatly interupt your program as its running.

If you want to work in real time I would suggest you use someting like an Arduino (I like the uno, cheap and easy), check out this link: https://store.arduino.cc/usa/arduino-uno-rev3
Reply
#3
(Aug-07-2018, 05:39 PM)Vysero Wrote: All that being said if you are interested in this working in real time then Python is not the way you want to go. This is because you will never be able to predict when Python say... goes garbage collecting or something like that which will ultimatly interupt your program as its running.

say again.... I like to drink a cup of coffee while waiting python to finish garbage collecting... very convenient, no rush at all...

(Aug-07-2018, 05:39 PM)Vysero Wrote: If you want to work in real time I would suggest you use someting like an Arduino (I like the uno, cheap and easy), check out this link: https://store.arduino.cc/usa/arduino-uno-rev3
and use python https://www.google.com/search?q=arduino+and+python
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#4
I have a raspberry pi 3+. I’ve seen a few tutorials for Arduino/Pi. There’s one that uses the pigpio library and one that uses the neopixel and argparse libraries. I’m leaning towards using the pigpio one which uses the SMD5050s. Is there an easier library to learn ?
Reply
#5
@buran To be completely honest I was just guessing when I made the point about garbage collection XD. In general, I wouldn't normally use Python to run I/O but I guess it was naive of me to think someone hasn't figure out a way to use it efficiently.

@Ostromaj I would just use whatever feels easier to you.
Reply
#6
Thanks :)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with Python Script to generate SVG Dot Matrix Pattern for LED Light Guide iamrickm 2 708 Aug-25-2023, 06:07 PM
Last Post: iamrickm
  Python and DMX (aka, light controller) ScottAF 4 2,541 Apr-06-2023, 07:09 PM
Last Post: ScottAF
  extract only text strip byte array Pir8Radio 7 2,786 Nov-29-2022, 10:24 PM
Last Post: Pir8Radio
Smile please help me remove error for string.strip() jamie_01 3 1,145 Oct-14-2022, 07:48 AM
Last Post: Pedroski55
  Can't strip extra characters from Data Canflyguy 7 1,813 Jan-10-2022, 02:16 PM
Last Post: Canflyguy
  strip() pprod 8 3,369 Feb-16-2021, 01:11 PM
Last Post: buran
  Need help with code for my WS2812B (Neopixel) Led Strip Phibbl 1 2,700 Apr-08-2020, 07:18 PM
Last Post: deanhystad
  split strip issues 'NonType' casacafe 8 3,756 Oct-08-2019, 06:29 PM
Last Post: ichabod801
  removing spaces/tabs after used .strip() zarize 0 1,552 Sep-11-2019, 12:46 PM
Last Post: zarize
  strip off just newlines Skaperen 11 5,219 Jun-19-2019, 06:28 PM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020