Lab 3: Ambient Orb

Made by Yiming Jiao

Learning how to use neopixel lights and IFTTT.

Created: November 16th, 2023

0

Outcome

In this Lab, I learnt how tu use IFTTT and 

0

Process

I work on this lab smoothly following the instruction. The only problem I met is IFTTT sometimes are not able to send command to the light, and I'm still not sure if it is IFTTT itsown problem or not.

0

Next Steps

As I mentioned above, I think I need to find out the reason why IFTTT not sending command to my controllor everytime.

0

Reflection

This lab allowing us to make a hands-on project is very attractive to me. We can start our first IoT product from here.

0
0
// This #include statement was automatically added by the Particle IDE.
#include <neopixel.h>

#define PIXEL_PIN D0
#define PIXEL_COUNT 16
#define PIXEL_TYPE WS2812

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
bool fadeRed = false;
bool fadeWhite = false;
unsigned long turnRed = 6000;
int lightness = 100;
uint32_t c = strip.Color(lightness, lightness, lightness);
unsigned long countTime = 0;

void setup() {
    strip.begin();
    strip.show(); // Initialize all pixels to 'off'
    Particle.function("15minAlarm", ledControl15min);
    Particle.variable("lightness", &lightness, INT);

}

void loop() {
    uint16_t i;
    if(fadeRed && millis() - countTime >= 60){
        lightness -= 1;
        c = strip.Color(100, lightness, lightness);
        if(lightness <= 0){
            fadeRed = false;
            fadeWhite = true;
        }
        countTime = millis();
    }else{
        if(fadeWhite && millis() - countTime >= 60){
            lightness += 1;
            c = strip.Color(100, lightness, lightness);
            if(lightness >= 100){
                fadeWhite = false;
            }
            countTime = millis();
        }
    }
    
    for(i=0; i< strip.numPixels(); i++) {
            strip.setPixelColor(i, c );
        }
    strip.show();
}

int ledControl15min(String command){
    fadeRed = true;
    countTime = millis();
    return -1;
}
Click to Expand
x
Share this Project

Courses

48-675 Designing for the Internet of Things 24

· 11 members

A hands-on introductory course exploring the Internet of Things and connected product experiences.


About

Learning how to use neopixel lights and IFTTT.