29 lines
821 B
C++
29 lines
821 B
C++
/*********
|
|
Rui Santos
|
|
Complete project details at https://RandomNerdTutorials.com/esp8266-relay-module-ac-web-server/
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
*********/
|
|
|
|
const int relay = 5;
|
|
|
|
void setup() {
|
|
Serial.begin(115200);
|
|
pinMode(relay, OUTPUT);
|
|
}
|
|
|
|
void loop() {
|
|
// Normally Open configuration, send LOW signal to let current flow
|
|
// (if you're usong Normally Closed configuration send HIGH signal)
|
|
digitalWrite(relay, LOW);
|
|
Serial.println("Current Flowing");
|
|
delay(5000);
|
|
|
|
// Normally Open configuration, send HIGH signal stop current flow
|
|
// (if you're usong Normally Closed configuration send LOW signal)
|
|
digitalWrite(relay, HIGH);
|
|
Serial.println("Current not Flowing");
|
|
delay(5000);
|
|
}
|