Things used in this project

Hardware components:
09264 1
RGB Diffused Common Cathode
×1
08776 01
SparkFun LilyPad Button Board
×1
11026 02
Jumper wires (generic)
×1
09590 01
LED (generic)
×2
12002 04
Breadboard (generic)
×1
Photon new
Particle Photon
×1
Mfr 25fbf52 221r sml
Resistor 221 ohm
×3
Openbuilds wire cable by foot
OpenBuilds Wire Cable - By the Foot
×1
Software apps and online services:
Xidmhfnahh6gnduppwzf
Particle Pi
Q8wtlimqnp04fzhtr9v5
IFTTT Maker service
Logo things yummo7uv2y
Google Android Things
Hand tools and fabrication machines:
09507 01
Soldering iron (generic)

Code

Blink an LEDC/C++
int led1 = D2;
int led2 = D3;
int red = D4;
int green = D5;
int blue = D6;

void setup()
{
   pinMode(led1, OUTPUT);
   pinMode(led2, OUTPUT);
   pinMode(red, OUTPUT);
   pinMode(green, OUTPUT);
   pinMode(blue, OUTPUT);
   Particle.function("led",ledToggle);
  
   digitalWrite(led1, LOW);
   digitalWrite(led2, LOW);
   digitalWrite(red, LOW); 
   digitalWrite(green, LOW);
   digitalWrite(blue, LOW);

}

void loop()
{
  
}

int ledToggle(String command) {
   

    if (command=="on") {
        digitalWrite(led1,HIGH);
        digitalWrite(led2,HIGH);
        return 1;
    }
    else if (command=="off") {
        digitalWrite(led1,LOW);
        digitalWrite(led2,LOW);
        digitalWrite(red, LOW); 
        digitalWrite(green, LOW);
        digitalWrite(blue, LOW);
        return 0;
    } else if (command=="red") {
        digitalWrite(red, HIGH);
        return 2;
    } else if (command=="green") {
        digitalWrite(green, HIGH);
        return 3;
    } else if (command=="blue") {
        digitalWrite(blue, HIGH);
        return 4;
    } else {
        return -1;
    }

}
    

Credits

96ce0161d8ea93aacde2dea68e449a06
Steven Gu
1 project • 0 followers
Contact
Thanks to Alejandro Tonda and Sarah Shi, Maya Nichols, Catherine Li.

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