Trouble using Neopixel on Teensey 4.0

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
redanac
 
Posts: 4
Joined: Wed Jul 01, 2020 7:17 pm

Trouble using Neopixel on Teensey 4.0

Post by redanac »

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

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

 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

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

User avatar
dastels
 
Posts: 15662
Joined: Tue Oct 20, 2015 3:22 pm

Re: Trouble using Neopixel on Teensey 4.0

Post by dastels »

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

User avatar
redanac
 
Posts: 4
Joined: Wed Jul 01, 2020 7:17 pm

Re: Trouble using Neopixel on Teensey 4.0

Post by redanac »

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

User avatar
dastels
 
Posts: 15662
Joined: Tue Oct 20, 2015 3:22 pm

Re: Trouble using Neopixel on Teensey 4.0

Post by dastels »

Have fun!

Dave

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”