An Tran
Published © MIT

Particle Photon Controls Grove Relay & Electromagnetic Lock

Connect a Grove Relay to a Particle Photon to control an electromagnetic lock.

EasyShowcase (no instructions)2 hours277
Particle Photon Controls Grove Relay & Electromagnetic Lock

Things used in this project

Hardware components

Photon
Particle Photon
×1
Grove - Relay
Seeed Grove - Relay
×1
Adafruit Solenoid - 12VDC
×1

Story

Read more

Code

PhotonGroveRelay

Arduino
#define BUTTONPIN D2
#define LEDPIN D7
#define RELAYPIN D4

void setup() {
    pinMode(LEDPIN, OUTPUT);
    pinMode(BUTTONPIN, INPUT);

    pinMode(RELAYPIN, OUTPUT);
    digitalWrite(RELAYPIN, LOW);
}

void loop() {
    if (digitalRead(BUTTONPIN) == 1) {
        digitalWrite(LEDPIN, HIGH);
        digitalWrite(RELAYPIN, HIGH);
    } else {
        digitalWrite(LEDPIN, LOW);
        digitalWrite(RELAYPIN, LOW);
    }
}

PhotonGroveRelay

Credits

An Tran

An Tran

5 projects • 8 followers
tech, startup, web, mobile, iot, dev
Contact

Comments

Add projectSign up / Login