Stephen Andrew DahlElliot Panicco
Published © GPL3+

Event Notifier with Particle Photon

Get notified when an event or assignment is coming up using IOT.

BeginnerFull instructions provided8 hours851
Event Notifier with Particle Photon

Things used in this project

Story

Read more

Schematics

Circuit Diagram

There is no circuit involved for either Photon. Just make sure the Photons are plugged into a power supply.

Code

Notifier Photon

C/C++
This is the photon that notifies you when an event is coming up. D7 LED turns on and waits for the controller photon to turn off LED
int boardLed = D7;


void setup()
{
    Particle.subscribe("photon_phanatics_com7", flickerled);
    Serial.begin(230400);
    pinMode(boardLed,OUTPUT); // Our on-board LED output
    Particle.subscribe("photon_phanatics_com10",button);
}
void flickerled (const char *event, const char *data)
{

    if(strcmp(data, "Upcoming_Event10_4")==0)
{
        digitalWrite(boardLed,HIGH);
        Serial.println("Upcoming_Event10_4");
}
}
void button(const char *event, const char *data)
{
    if(strcmp(data,"buttonpressed")==0)
    {
        digitalWrite(boardLed,LOW);
        delay(15000);
}
}

Initial Control Photon

C/C++
This photon is used to communicate with and control other photons.
SYSTEM_THREAD(ENABLED)
bool buttonset = false;

void setup()
{
Particle.subscribe("Upcoming_Event10_4", writetoscreen); 
//receive from IFTTTT send to function
}

  
void writetoscreen(const char *event, const char *data)
{
    if(strcmp(event,"Upcoming_Event10_4")==0) 
    { //compare variable and determine meaning
        
        Particle.publish("photon_phanatics_com7","Upcoming_Event10_4", 60);
}}

void loop() {
    if (System.buttonPushed() > 500) {
        Particle.publish("photon_phanatics_com10", "buttonpressed", 60); 
        buttonset = true;
        delay(5000);
    }
}

Credits

Stephen Andrew Dahl

Stephen Andrew Dahl

1 project • 1 follower
The university of North Carolina at Charlotte. Double major Mechanical Engineering and Physics.
Elliot Panicco

Elliot Panicco

1 project • 0 followers

Comments