Help With Code
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- nhall22
- Posts: 3
- Joined: Fri Apr 21, 2023 2:32 pm
Help With Code
I am new to coding and need help with the goggles. I have the goggles working like they should but I want to change the code so they only spin one color and only spin no sparkle.
- dastels
- Posts: 15662
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Help With Code
There are several goggle projects. Can you link to the one you're working on?
Dave
Dave
- nhall22
- Posts: 3
- Joined: Fri Apr 21, 2023 2:32 pm
- dastels
- Posts: 15662
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Help With Code
OK. I did that as one of my first NeoPixel projects. The next question is whether you are using C++ or CircuitPython.
Dave
Dave
- dastels
- Posts: 15662
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Help With Code
ok. Comment out that last if structure (the every 8 seconds one)
Changing the while True: loop to the following should do it. It's just the spin forever in a single color code.
Dave
Changing the while True: loop to the following should do it. It's just the spin forever in a single color code.
Code: Select all
while True:
# Spinny wheels (8 LEDs on at a time)
for i in range(0, numpix):
c = 0
# 4 pixels on...
if ((offset + i) & 7) < 2:
c = color
pixels[i] = c # First eye
pixels[(numpix - 1) - i] = c # Second eye (flipped)
pixels.write()
offset += 1
time.sleep(0.05)
Please be positive and constructive with your questions and comments.