Stephen Simon
Published © GPL3+

Connecting Particle Photon with Twitter, Facebook or Mail

Whenever someone tweets you or sends a Facebook message or you receive a mail, a LED on Photon glows.

BeginnerFull instructions provided1 hour2,437
Connecting Particle Photon with Twitter, Facebook or Mail

Things used in this project

Hardware components

Photon
Particle Photon
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1
Breadboard (generic)
Breadboard (generic)
×1
LED (generic)
LED (generic)
×1

Software apps and online services

Particle Buid
Twitter service
IFTTT Twitter service

Story

Read more

Schematics

Particle Photon Connections

Code

Code

Arduino
//The pin you want to control, in this case I'm blinking the on-board blue LED on digital pin 7
int led = D7;
//This function is called after the Photon has started 
void setup(){
    //We set the pin mode to output
    pinMode(led, OUTPUT);
    //We "Subscribe" to our IFTTT event called Button so that we get events for it 
    Particle.subscribe("Button", myHandler);
}
//The program loop, not sure if this has to be here for the program to run or not
void loop() {
}
//The function that handles the event from IFTTT
void myHandler(const char *event, const char *data){
    // We'll turn the LED on
    digitalWrite(led, HIGH);
    
    // We'll leave it on for 5 second...
    delay(5000);
    
    //Then we'll turn it off...
    digitalWrite(led, LOW);
}

Credits

Stephen Simon

Stephen Simon

3 projects • 45 followers
Stephen is a Technical Evangelist & Microsoft Innovative Educator who often travels to deliver session & talk about trending technologies.

Comments

Add projectSign up / Login