Things used in this project

Hardware components:
Photon new
Particle Photon
×1
09590 01
LED (generic)
×10
Mfr 25fbf52 221r sml
Resistor 221 ohm
×1
Software apps and online services:
Q8wtlimqnp04fzhtr9v5
IFTTT Maker service
Hand tools and fabrication machines:
Lasercutter
Laser cutter (generic)
09507 01
Soldering iron (generic)

Schematics

fritzing_k5VEbbNbgM.JPG
Fritzing k5vebbnbgm

Code

Untitled fileC/C++
int red = D7; 
int green = D0;
int b = D1;
int g = D2;
int r = D3;
int milli = 700;
// used variables to make the code more straightforward

void setup() {

  pinMode(r, OUTPUT);
  pinMode(g, OUTPUT);
  pinMode(b, OUTPUT);
  
  Particle.function("led", festive); //tricolor diode function
  Particle.function("lights", ledToggle); //function to determine the speed of blinking lights
  
  digitalWrite(r, LOW);
  digitalWrite(g, LOW);
  digitalWrite(b, LOW);
  
  pinMode(red, OUTPUT);
  pinMode(green, OUTPUT);

}

int ledToggle(String command){
    if (command=="1000"){
        int milli = 1000;
    }
    else if (command=="500"){
        int milli = 500;
    }
    else if (command=="700"){
        int milli = 700;
    }
    //changes the variable of milli with texts from phone
}


void loop() {

  digitalWrite(red, HIGH);
  digitalWrite(green, LOW);
  delay(milli);

  digitalWrite(red, LOW);
  digitalWrite(green, HIGH);
  delay(milli);

//alternates red and green led's blinking

}

int festive(String command){
       if (command=="it's christmas") {
        digitalWrite(r, HIGH);
        digitalWrite(g, HIGH);
        digitalWrite(b, HIGH);
        return 1;
    }
    else if (command=="red"){
        digitalWrite(r, HIGH);
        digitalWrite(g, LOW);
        digitalWrite(b, LOW);
        return 2;
    }
    else if (command=="green"){
       digitalWrite(r, LOW);
       digitalWrite(g, HIGH);
       digitalWrite(b, LOW);
        return 3;
    }
    else if (command=="blue"){
        digitalWrite(r, LOW);
        digitalWrite(g, LOW);
        digitalWrite(b, HIGH);
        return 4;
    }
    else if (command=="off"){
        digitalWrite(r, LOW);
        digitalWrite(g, LOW);
        digitalWrite(b, LOW);
        return 0;
    }
    else {
        return -1;
    }
}

Credits

614802e7494d69e872383210212b1bae
Caroline von Raesfeld
1 project • 0 followers
Contact
1e5afc1b9e248a06e883974967af9cde
Everett Teran
1 project • 0 followers
Beans
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Add projectSign up / Login