Answers for "grove relay photon"

0

grove relay photon

#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);
    }
}
Posted by: Guest on August-15-2021

Code answers related to "grove relay photon"

Browse Popular Code Answers by Language