Grace Skills Dev III: Ambient Orb
Made by Grace Zhu
Made by Grace Zhu
This goal of this project is to create an ambient calendar alert using a neopixel strip.
Created: November 13th, 2024
The objective for this project is to create an ambient calendar alert using a neopixel strip.
In class, I practiced soldering and soldered my neopixel strip. Then I tried different programs to make my neopixel strip light up in different ways. For my project, I first decided on how the light will behave and wrote it into a function. Lastly I called the function from my console and debugged with ChatGPT.
*I originally wanted to do a fade from orange to red function but I kept getting my strip to light up green. No matter how I debug it always started on green so I gave up.
// This #include statement was automatically added by the Particle IDE.
#include <neopixel.h>
// Include Particle Device OS APIs
#include <Particle.h>
#define PIXEL_PIN SPI
#define PIXEL_COUNT 8
#define PIXEL_TYPE WS2812B
Adafruit_NeoPixel strip =
Adafruit_NeoPixel( PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE );
void setup() {
// Initialize the strip
strip.begin();
delay(200); // Small delay for stabilization
// Set all pixels to black at startup
for (int i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, 0, 0, 0); // Set each pixel to black (off)
}
strip.show();
// Register the cloud function
Particle.function("calendarNotification", flashRedFaster);
}
void loop() {
// If you want animations or continuous effects, add code here
}
// Function to flash red from slower to faster
int flashRedFaster(String command) {
int delayTime = 500; // Start with a delay of 500ms (half a second)
// Loop to gradually decrease delay time, speeding up the flashes
for (int j = 0; j < 10; j++) { // Flash 10 times, increasing speed
// Turn all pixels red
for (int i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, 255, 0, 0); // Set each pixel to red
}
strip.show();
delay(delayTime); // Delay for the current flash speed
// Turn all pixels off
for (int i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, 0, 0, 0); // Set each pixel to black (off)
}
strip.show();
delay(delayTime); // Delay for the current flash speed
// Decrease delay time to make flashes faster
delayTime = max(50, delayTime - 50); // Decrease delay, but not below 50ms
}
return 1; // Return success
}
Click to Expand
This goal of this project is to create an ambient calendar alert using a neopixel strip.