Caroline von RaesfeldEverett Teran
Published

Christmas LED Display

Fun, festive, and frivolous! It lights up and sends you a Christmas text!

EasyFull instructions provided62
Christmas LED Display

Things used in this project

Hardware components

Photon
Particle Photon
×1
LED (generic)
LED (generic)
×10
Resistor 221 ohm
Resistor 221 ohm
×1

Software apps and online services

Maker service
IFTTT Maker service

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

fritzing_k5VEbbNbgM.JPG

Fritzing k5vebbnbgm

Code

Untitled file

C/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

Caroline von Raesfeld

Caroline von Raesfeld

1 project • 0 followers
Contact
Everett Teran

Everett Teran

0 projects • 0 followers
Beans
Contact

Comments

Add projectSign up / Login