Particle Photon Relay Shield Android APP

Hello folks,

I’m the proud owner of a relay shield and use it to control my lights at home and my garage door.
I made a simple costumisable android app and released it to the playstore for all the people that don’t want to get into the details of building an android app.
For now it has 4 buttons (4 relays on the board) but if there is need I could expand the app itself.
In the settings you can define the name of the buttons as the command they call on the photon itself.

Photon code:

int relay1 = D3;
int relay2 = D4;
int relay3 = D5;
int relay4 = D6;
void setup() {
    pinMode(relay1, OUTPUT);
    pinMode(relay2, OUTPUT);
    pinMode(relay3, OUTPUT);
    pinMode(relay4, OUTPUT);
    Particle.function("Command1",switchrelay1);
    Particle.function("Command2",switchrelay2);
    Particle.function("Command3",switchrelay3);
    Particle.function("Command4",switchrelay4);
}

void loop() {

}
int switchrelay1(String dada) {
        digitalWrite(relay1,HIGH);
        delay(500);
        digitalWrite(relay1,LOW);
        return 1;
}
int switchrelay2(String dada) {
        digitalWrite(relay2,HIGH);
        delay(500);
        digitalWrite(relay2,LOW);
        return 1;
}
int switchrelay3(String dada) {
        digitalWrite(relay3,HIGH);
        delay(500);
        digitalWrite(relay3,LOW);
        return 1;
}
int switchrelay4(String dada) {
        digitalWrite(relay4,HIGH);
        delay(500);
        digitalWrite(relay4,LOW);
        return 1;
}

The app is available here:
Playstore - Homecontrol

2 Likes

Thanks for sharing this!

Not a problem at all. Needed it for myself, might as well share it with everybody. There are plans to upgrade the app to 8 functions and multiple devices.

Grtz

2 Likes

This is great, just one question, under device in the app, is this for your device id? There aren’t any instructions.

Yes it’s for device id

2 Likes