Space Goggles of Awesomeness
thingiverse
This is a C++ code snippet that appears to be a custom program for an Adafruit Trinket microcontroller, specifically designed for low-power NeoPixel goggles. Here's a breakdown of the code: **Includes** The code includes the necessary libraries for the NeoPixel library and the `TinyISP` programmer. **Constants and Variables** The code defines several constants and variables: * `NEOPIXEL_PIN`: The digital I/O pin connected to the Neopixel string (set to 0). * `NEOPIXEL_COUNT`: The total number of Neopixels in the chain (2 x 16 = 32). * `pixels`: An instance of the `Adafruit_NeoPixel` class, initialized with the number of pixels and the pin number. * `PIN_BUTTON_A`: The I/O pin connected to a momentary contact pushbutton (shared with USB) (set to 3). * `pressTime`, `buttonState`, `mode`, `offset`, `color`, `N_COLORS`, and `colors` are all variables used for button debouncing, animation effects, color sequences, and other purposes. **Setup** The code sets up the Neopixel string by calling the `pixels.begin()` method to initialize it with a speed of 800 kHz. **Main Loop** The main loop consists of several sections: 1. Button Debouncing: The code checks if the button has been pressed or released, and updates the `buttonState` variable accordingly. 2. Animation Effect: If the animation effect is not in auto-mode (i.e., `autoMode == 0`), it advances the color sequence manually based on user input. 3. Auto-Mode: If the animation effect is in auto-mode, it cycles through a predefined set of colors (defined in the `colors[]` array). 4. Display Colors: The code sets the color of each Neopixel LED using the `pixels.setPixelColor()` method. **Functions** The code defines two functions: * `advanceMode()`: Advances the animation effect mode and color sequence. * `pressTime()`: Not used in this code snippet, but likely used for debouncing purposes. **Notes** This code appears to be a modified version of an Adafruit example program. The author has added support for a momentary-contact pushbutton on pin #3, which toggles the animation effect between auto-mode and manual mode when pressed for longer than 1/2 second. Shorter button presses advance the color sequence manually. The code assumes that the Neopixel rings are connected to the Trinket board's digital I/O pins (pin 0 in this case) and that the momentary contact pushbutton is shared with USB on pin #3. The animation effects and color sequences can be customized by modifying the `colors[]` array and adding new animation effects using the `mode` variable. Overall, this code provides a basic framework for creating interactive low-power NeoPixel goggles with customizable animation effects and button control.
With this file you will be able to print Space Goggles of Awesomeness with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on Space Goggles of Awesomeness.