Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie in need of a lot of help
#1
Yes, I'm sure I've already scared off everyone who might have been able to help me with just that title, fantastic!

So, let me start off by saying that I have practically no experience with any coding. I have a good understanding of computers and such though. Just never gotten much into the whole coding thing but if it comes down to it, I'll just have to learn.

So, what is it that I need help with then?
Well, basically what I have is a Adafruit Neopixel Mini Skinny strip that is connected to an RPi3.
And what I want to get running on it is a simple color shifting script. Going through the color spectrum at a not all too rapid rate.

I've managed to get it to light up with the old stuff that lead me here, the "RPi-LPD8806" which had an example.py in it and that worked, I messed about with it a little just to see how it ticked. But of course, it's better to move over to the new and updated stuff.

Are there some basic examples included already that I just haven't gotten to work yet? I recall something about that. Say, like animation.py and all I need to do there is to add something about using the right drivers? Or grab some code of someone else here and add the correct driver?
Yes, I know it's lazy but honestly, at the moment I mostly just want to get it working and then possibly start tweaking it myself.

While I would like to do some stuff later on where it would also be affected by audio playing, it's not really necessary and it might not even be possible, I don't know! Lightshowpi seems to kinda support that but it seemed a lot more complicated and I couldn't even get an example to run. But that's all in the future and not really needed, just extra flair that would be nifty.

Thanks in advance!
#2
With the help of a friend I've made some progress at least.
I've taken the example from https://github.com/ManiacalLabs/BiblioPixel/wiki/Writing-an-Animation
and have created this:

Code:
from bibliopixel.led import *
from bibliopixel.animation import BaseStripAnim
from bibliopixel.drivers.PiWS281X import *
from bibliopixel import LEDStrip
import bibliopixel.colors as colors
#c_order = ChannelOrder.BRG
numLeds = 30
driver = DriverPiWS281X(numLeds, ledPin = 13)
led = LEDStrip(driver)

class StripTest(BaseStripAnim):
   def __init__(self, led, start=0, end=-1):
       #The base class MUST be initialized by calling super like this
       super(StripTest, self).__init__(led, start, end)
       #Create a color array to use in the animation
       self._colors = [colors.Red, colors.Orange, colors.Yellow, colors.Green, colors.Blue, colors.Indigo]

   def step(self, amt = 1):
       #Fill the strip, with each sucessive color
       for i in range(self._led.numLEDs):
           self._led.set(i, self._colors[(self._step) % len(self._colors)])
       #Increment the internal step by the given amount
       self._step += amt

anim = StripTest(led)
anim.run()
I've installed the rpi_ws281x stuff. But when I run the code I get the following message in the terminal:


Code:
Traceback (most recent call last):
 File "work.py", line 8, in <module>
   driver = DriverPiWS281X(numLeds, ledPin = 13)
 File "/usr/local/lib/python2.7/dist-packages/bibliopixel/drivers/PiWS281X.py", line 27, in __init__
   self._strip.begin()
 File "build/bdist.linux-armv7l/egg/neopixel.py", line 115, in begin
RuntimeError: ws2811_init failed with code -7 (Unable to initialize GPIO)


I got the DI wire hooked up to GPIO 13 on the Pi according to this http://i.stack.imgur.com/RILry.png

But now I'm kind of at a loss. Any ideas?

Edit: Having gone back to GPIO 18 (with the main.c and recompiling that), I'm no longer getting any errors but nothing shows up on the strip either.
It just remains unlit and I have to ctrl+c to get back to the terminal. Which does get me the following:

Code:
Traceback (most recent call last):
  File "work.py", line 26, in <module>
    anim.run()
  File "/usr/local/lib/python2.7/dist-packages/bibliopixel/animation.py", line 191, in run
    self._run(amt, fps, sleep, max_steps, untilComplete, max_cycles, seconds)
  File "/usr/local/lib/python2.7/dist-packages/bibliopixel/animation.py", line 130, in _run
    self._led.update()
  File "/usr/local/lib/python2.7/dist-packages/bibliopixel/led.py", line 201, in update
    self.driver[i]._update(data[i])
  File "/usr/local/lib/python2.7/dist-packages/bibliopixel/drivers/driver_base.py", line 54, in _update
    self.update(data)
  File "/usr/local/lib/python2.7/dist-packages/bibliopixel/drivers/PiWS281X.py", line 44, in update
    self._strip.setPixelColor(i, NeoColor(pixels[i][0], pixels[i][1], pixels[i][2]))
  File "build/bdist.linux-armv7l/egg/neopixel.py", line 124, in setPixelColor
KeyboardInterrupt


Edit2: Sorted it out. I had to install this version of rpi_ws281x: https://github.com/tonydew/rpi_ws281x/tree/LED-ordering
#3
You've also got to always run with sudo Smile


Forum Jump:


Users browsing this thread: 1 Guest(s)