Goal: Recap Arduino basics and set up the workspace.
Activities:
Goal: Understand how the Neopixel library controls the LED ring.
Activities:
setPixelColor()
and show()
are essential for basic operations.Challenge:
setPixelColor()
where color is a combination of red, green, and blue values. This function allows for precise control over each LED's color on the ring.Potentially useful functions (fill in the blanks!):
begin()
- Initializes the pin and sets up the Neopixel strip.show()
- Sends the updated color data to the Neopixel ring.setPixelColor(index, color)
- Sets the color of a specific LED in the ring.fill(color, firstLED, count)
- Fills a number of LEDs with a specified color starting from a particular index.setBrightness()
clear()
fill()
Adafruit Neopixel Library on GitHub Adafruit Neopixel Library Documentation Adafruit Neopixel Code Snippets
Goal: Apply understanding by analyzing and modifying provided example code.
Activities:
setPixelColor()
function to adjust colors and experiment with setBrightness()
to see the effect on the ring's luminosity.// NeoPixel Ring simple sketch (c) 2013 Shae Erisson // Released under the GPLv3 license to match the rest of the // Adafruit NeoPixel library #include <Adafruit_NeoPixel.h> #ifdef __AVR__ #include <avr/power.h> // Required for 16 MHz Adafruit Trinket #endif // Why do we have these #define instructions and how do they differ from regular variables? #define PIN 6 // On Trinket or Gemma, suggest changing this to 1 #define NUMPIXELS 16 // Popular NeoPixel ring size // Declare our NeoPixel strip object: // Argument 1 = Number of LEDs in NeoPixel ring // Argument 2 = Arduino pin number (most are valid) // Argument 3 = Pixel type flags, add together as needed: // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products) // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2) // NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products) Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); #define DELAYVAL 500 // Time (in milliseconds) to pause between pixels void setup() { pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED) } void loop() { pixels.clear(); // Set all pixel colors to 'off' for(int i = 0; i < NUMPIXELS; i++) { // For each pixel... pixels.setPixelColor(i, pixels.Color(0, 150, 0)); pixels.show(); // Send the updated pixel colors to the hardware. delay(DELAYVAL); // Pause before next pass through loop } }
Goal: Develop custom light patterns and sequences.
Activities:
Challenges: