Hi I have a Gemma M0 board that when I load a code for a 8 pixel strip nothing lights up. Coding test ok but nothing happens. Is there a separate library for these?
https://www.adafruit.com/product/1426
gemma M0 neopixel
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Franklin97355
- Posts: 23911
- Joined: Mon Apr 21, 2008 2:33 pm
Re: gemma M0 neopixel
It should use the Neopixel library. Can you post a picture of your connections? What code are you running?
- Spica1
- Posts: 4
- Joined: Mon Aug 06, 2018 6:33 pm
Re: gemma M0 neopixel
I used codes from Github and here have been trying a few different ones since I dont even get one color. I have tried using A1 D2 and D1 as outputs and no change.
# CircuitPython demo - NeoPixel
import time
import board
import neopixel
pixpin = board.D1
numpix = 10
strip = neopixel.NeoPixel(pixpin, numpix, brightness=0.3, auto_write=False)
def wheel(pos):
# Input a value 0 to 255 to get a color value.
# The colours are a transition r - g - b - back to r.
if (pos < 0) or (pos > 255):
return (0, 0, 0)
if pos < 85:
return (int(pos * 3), int(255 - (pos * 3)), 0)
elif pos < 170:
pos -= 85
return (int(255 - pos * 3), 0, int(pos * 3))
else:
pos -= 170
return (0, int(pos * 3), int(255 - pos * 3))
def rainbow_cycle(wait):
for j in range(255):
for i in range(len(strip)):
idx = int((i * 256 / len(strip)) + j)
strip = wheel(idx & 255)
strip.write()
time.sleep(wait)
while True:
strip.fill((255, 0, 0))
strip.write()
time.sleep(1)
strip.fill((0, 255, 0))
strip.write()
time.sleep(1)
strip.fill((0, 0, 255))
strip.write()
time.sleep(1)
rainbow_cycle(0.001) # rainbowcycle with 1ms delay per step
# CircuitPython demo - NeoPixel
import time
import board
import neopixel
pixpin = board.D1
numpix = 10
strip = neopixel.NeoPixel(pixpin, numpix, brightness=0.3, auto_write=False)
def wheel(pos):
# Input a value 0 to 255 to get a color value.
# The colours are a transition r - g - b - back to r.
if (pos < 0) or (pos > 255):
return (0, 0, 0)
if pos < 85:
return (int(pos * 3), int(255 - (pos * 3)), 0)
elif pos < 170:
pos -= 85
return (int(255 - pos * 3), 0, int(pos * 3))
else:
pos -= 170
return (0, int(pos * 3), int(255 - pos * 3))
def rainbow_cycle(wait):
for j in range(255):
for i in range(len(strip)):
idx = int((i * 256 / len(strip)) + j)
strip = wheel(idx & 255)
strip.write()
time.sleep(wait)
while True:
strip.fill((255, 0, 0))
strip.write()
time.sleep(1)
strip.fill((0, 255, 0))
strip.write()
time.sleep(1)
strip.fill((0, 0, 255))
strip.write()
time.sleep(1)
rainbow_cycle(0.001) # rainbowcycle with 1ms delay per step
- caitlinsdad
- Posts: 627
- Joined: Fri Feb 24, 2012 4:23 pm
Re: gemma M0 neopixel
I know that Circuit Python is in constant development so I have run across sample code that may not work with updated versions or used on different boards that the code was not specifically written for.
Try changing the strip.write() command to strip.show()
Try the different pin names. Hope it works then. Good luck.
Try changing the strip.write() command to strip.show()
Try the different pin names. Hope it works then. Good luck.
- Spica1
- Posts: 4
- Joined: Mon Aug 06, 2018 6:33 pm
Re: gemma M0 neopixel
Been trying all the pin outs and still no pixel even lights up. I tried a simple LED on the outputs and they do work but just with neopixels I am having problems.
- caitlinsdad
- Posts: 627
- Joined: Fri Feb 24, 2012 4:23 pm
Re: gemma M0 neopixel
If you go through the Gemma M0 guide, it may help to at least get the onboard Dotstar working and then get external neopixels working. https://learn.adafruit.com/adafruit-gemma-m0?view=all
You might want to post a picture of your setup to see how things are wired up. Neopixels need to be hooked up correctly to work. Do you have a stick of neopixels or a cut strip of neopixels?
You might want to post a picture of your setup to see how things are wired up. Neopixels need to be hooked up correctly to work. Do you have a stick of neopixels or a cut strip of neopixels?
- Spica1
- Posts: 4
- Joined: Mon Aug 06, 2018 6:33 pm
Re: gemma M0 neopixel
IT is the 8 pixel stick and got them to work. I replaced the lib folder with new ones one at at time and that fixed the issue.
Thanks for all the tips!
Thanks for all the tips!
Please be positive and constructive with your questions and comments.