Last active
May 11, 2020 02:55
-
-
Save tjpeden/82b0d67a16601136093b4f62a9945253 to your computer and use it in GitHub Desktop.
Relay toggle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a global variable | |
const int relay1 = 7; // let's call pin 7 relay1 | |
// This is the setup function which gets run once, when the MCU gets reset | |
void setup() { | |
pinMode(relay1, OUTPUT); // set pin 7 to an output pin | |
digitalWrite(relay1, HIGH); // set pin 7 high | |
} | |
// This is the loop function which gets called repeatedly forever | |
void loop() { | |
digitalWrite(relay1, LOW); // set pin 7 low | |
delay(500); // wait 500ms | |
digitalWrite(relay1, HIGH); // set pin 7 high | |
delay(300); // wait 300ms | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment