Need Help with UFO 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
Dcat
 
Posts: 5
Joined: Thu Dec 09, 2021 3:42 pm

Need Help with UFO Code

Post by Dcat »

Hi, I'm jose,

I need help with customizing the ufo code that is provided. I would like my light ring to do the exact thing in the video Adafruit made on the project.
https://learn.adafruit.com/ufo-drone/code
this is the link to the project.

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Need Help with UFO Code

Post by mikeysklar »

Have you been able to assemble and run the example code? Using the theaterChase function set to green should get you the tractor beam effect shown in the video. This would be used in the main loop() in place of the other functions.

Code: Select all

theaterChase(strip.Color(0, 255, 0), 50);

User avatar
Dcat
 
Posts: 5
Joined: Thu Dec 09, 2021 3:42 pm

Re: Need Help with UFO Code

Post by Dcat »

Yes, the strand test wheel code does work. I just wanted the tractor-beam effect. Thanks, I haven't had the time to learn the code.

User avatar
Dcat
 
Posts: 5
Joined: Thu Dec 09, 2021 3:42 pm

Re: Need Help with UFO Code

Post by Dcat »

Ok, I have no clue where this line of code goes. This is what I have now not really sure what to do.

void loop() {
// Some example procedures showing how to display to the pixels:
//colorWipe(strip.Color(255, 0, 0), 50); // Red
//colorWipe(strip.Color(0, 255, 0), 50); // Green
//colorWipe(strip.Color(0, 0, 255), 50); // Blue
//colorWipe(strip.Color(0, 0, 0, 255), 50); // White RGBW
// Send a theater pixel chase in...
//theaterChase(strip.Color(127, 127, 127), 50); // White
//theaterChase(strip.Color(127, 0, 0), 50); // Red
theaterChase(strip.Color(0, 0, 127), 50); // Blue

//rainbow(20);
//rainbowCycle(20);
//theaterChaseRainbow(50);
}

//Theatre-style crawling lights.
void theaterChase(uint32_t c, uint8_t wait) {
for (int j=0; j<10; j++) { //do 10 cycles of chasing
for (int q=0; q < 3; q++) {
for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, c); //turn every third pixel on
}
strip.show();


delay(wait);

for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, 0); //turn every third pixel off
}
}
}
}

User avatar
Dcat
 
Posts: 5
Joined: Thu Dec 09, 2021 3:42 pm

Re: Need Help with UFO Code

Post by Dcat »

Also, the ring has four colors going around. red,green,blue,and white.

User avatar
Dcat
 
Posts: 5
Joined: Thu Dec 09, 2021 3:42 pm

Re: Need Help with UFO Code

Post by Dcat »

Also, I'm using the NeoPixel 1/4 60 Ring - 5050 RGBW LED w/ Integrated Drivers. Not sure if there are any differences between the code for the smaller rings.

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

Return to “Trinket ATTiny, Trinket M0”