Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

Trouble using Neopixel on Teensey 4.0
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Trouble using Neopixel on Teensey 4.0

by redanac on Wed Jul 01, 2020 7:33 pm

Hi, I'm very new to CircuitPython and am using a Teensy 4.0. I am trying to connect my WS2813 144 led strip for a project I'm doing but I'm having trouble with the neopixel library. I keep getting an error when trying a simple script shown below to light a few pixels.

Code: Select all | TOGGLE FULL SIZE
import neopixel
import board

pin_number = board.D6
num_pixels = 144

pixels = neopixel.NeoPixel(pin_number, num_pixels, auto_write=False)
pixels[0] = (255, 0, 0)
pixels[9] = (0, 255, 0)
pixels.show()


the error is as follows:

Code: Select all | TOGGLE FULL SIZE
 File "code.py", line 7, in <module>
TypeError: function missing required positional argument #3


looking at the neopixel library on github here this third missing argument is apparently the bytes per pixel (3 in my case). When I add this argument to the code I am given the following error

Code: Select all | TOGGLE FULL SIZE
File "code.py", line 7, in <module>
  File "adafruit_seesaw/neopixel.py", line 98, in __init__
AttributeError: 'Pin' object has no attribute 'write'


If anyone could give me some advice on how to get this code to work I would very grateful :)

Thanks

Redha

redanac
 
Posts: 2
Joined: Wed Jul 01, 2020 7:17 pm

Re: Trouble using Neopixel on Teensey 4.0

by dastels on Wed Jul 01, 2020 7:58 pm

The only positional arguments I see are the pin and number of pixels.

Please make sure you are using the latest version of CircuitPython and the libraries. It sounds like you might have an older library.

Dave

dastels
 
Posts: 3076
Joined: Tue Oct 20, 2015 3:22 pm

Re: Trouble using Neopixel on Teensey 4.0

by redanac on Thu Jul 02, 2020 4:20 am

That's done the trick, odd though because I'd downloaded the latest library bundle. thanks for your help!!

redanac
 
Posts: 2
Joined: Wed Jul 01, 2020 7:17 pm

Re: Trouble using Neopixel on Teensey 4.0

by dastels on Thu Jul 02, 2020 10:21 am

Have fun!

Dave

dastels
 
Posts: 3076
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.