Help With Code

Adafruit's tiny microcontroller platform. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
nhall22
 
Posts: 3
Joined: Fri Apr 21, 2023 2:32 pm

Help With Code

Post by nhall22 »

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.

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

Re: Help With Code

Post by dastels »

There are several goggle projects. Can you link to the one you're working on?

Dave

User avatar
nhall22
 
Posts: 3
Joined: Fri Apr 21, 2023 2:32 pm

Re: Help With Code

Post by nhall22 »


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

Re: Help With Code

Post by dastels »

OK. I did that as one of my first NeoPixel projects. The next question is whether you are using C++ or CircuitPython.

Dave

User avatar
nhall22
 
Posts: 3
Joined: Fri Apr 21, 2023 2:32 pm

Re: Help With Code

Post by nhall22 »

Im using Circuit Python

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

Re: Help With Code

Post by dastels »

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.

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)
Dave

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

Return to “Trinket ATTiny, Trinket M0”