-
-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Errors running visualization.py #76
Comments
Hello. elif config.DEVICE == 'pi':
from rpi_ws281x import *
strip = Adafruit_NeoPixel(config.N_PIXELS, config.LED_PIN,
config.LED_FREQ_HZ, config.LED_DMA,
config.LED_INVERT, config.BRIGHTNESS)
strip.begin() This object, strip, is a instance of the class Adafruit_NeoPixel and this is throwing the AttributeError. I notice the constructor of Adafruit_NeoPixel takes constants from the config.py file. Can you confirm you followed step seven from the README file under "Setup and Configuration"
|
Hi Yes I have set the number of pixels etc in the config.py file. It doesn't seem to like the code "strip._led_data[i] = int(rgb[i])" it thinks _led_data is an attribute of Adafruit_NeoPixel If I comment that line out the code runs but obviously the LEDs don't work. Regards |
strip._led_data[i] = int(rgb[i]) Strip, the instance of the Adafruit_NeoPixel object, must have a _.led_data param in it's @naztronaut can you point me in the right direction please? 😃 |
I can see it in [rpi_ws281x] (https://github.com/richardghirst/rpi_ws281x/tree/master)/[python](https://github.com/richardghirst/rpi_ws281x/tree/master/python) /neopixel.py Maybe I have the wrong one? |
Hi, It's been a few years since I worked on the project, will do my best to help. Did you install the |
Good find @WarrenLead. Here is our definition on line 83 in neopixel.py ## Grab the led data array.
self._led_data = _LED_Data(self._channel, num) Perhaps the interpreter can't find rpi_ws281x as @naztronaut suggested. Alternatively I remember reading somewhere that python slots sometimes hides variables by pre-pending a second underscore to their variables. However if that's the case the issue would need to be moved to rpi_ws281x. |
My rpi_ws281x was already installed by sudo pip3 install rpi_ws281x for another project and it is working. I also have sudo pip3 install adafruit-circuitpython-neopixel installed |
@naztronaut does you're library require a specific version? 😄 |
Yes it would appear the version I have is different as it doesnt have the _led.data _## Grab the led data array. How do I install the correct one? |
Looks like rpi_ws281x was updated to v5.0.0 approx 2 months ago and _led_data was removed. Previous version has it, I.e 4.3.4 see https://pypi.org/project/rpi-ws281x/4.3.4/ I will try to install this. |
@WarrenLead let me know if this works? It will depend on your version of Python.
@naztronaut would you like some assistance modernizing the code to be compatible with the modification to rpi_ws281x? |
Installing 4.3.4 fixed the _led_data issue but I obviously have other compatibility issues as it is still not working. |
Hi @naztronaut Any chance you (or anyone else) can give this a go using a Pi 4 and current libraries to expose issues? I followed the install procedure described and had numerous issues. I worked through installing and reinstalling step by step and found I needed rpi_ws281x v4.3.4 as current version 5 is not compatible. I also had problems with the audio libraries. I just cant get it to function any lights. I know I am close I just cant get over the last hurdle. I would love to get this working. Regards |
I am a linux newbie and am having similar problems to WarrenLead. Fixed the rpi_ws281x version problem and visualization now runs to the point where it turns LEDs on, but getting server socket errors and invalid input device error - Alsa not recognising USB mic. After several hours of trying to get this working, would really love to have a solution before Christmas. |
Hi Warren I couldnt get the audio part working and I spent hours and hours getting nowhere so I gave up. I ended up buying a couple of nice Wifi LED controllers on ebay for about $20 bucks each, which work great, but it is a shame because I really was enjoying playing with the lights on the Ras Pi. I'm all primed and ready for Christmas now :-) |
I was able to put it to work after running some of the suggestions here. Leds are going on ... but not producing the effect in the video. But it's a start. |
Howdy everyone! Just wanted to add in that if anyone is having this problem, rather than downgrade the Adafruit library, you can change it to:
and it should also work. |
When I issue the command "sudo python3 visualization.py scroll" I get an error
Traceback (most recent call last):
File "/home/pi/dancyPi-audio-reactive-led/python/visualization.py", line 418, in
led.update()
File "/home/pi/dancyPi-audio-reactive-led/python/led.py", line 144, in update
_update_pi()
File "/home/pi/dancyPi-audio-reactive-led/python/led.py", line 108, in _update_pi
strip._led_data[i] = int(rgb[i])
AttributeError: 'Adafruit_NeoPixel' object has no attribute '_led_data'
Any ideas?
The text was updated successfully, but these errors were encountered: