Last active
January 2, 2022 19:38
-
-
Save SimedruF/3e06f0a6cfa7f59ad6fe47e0ea8c2b6f to your computer and use it in GitHub Desktop.
Arduino_relay.ino
This file contains hidden or 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
/* | |
Florin Simedru | |
Complete project details at https://automatic-house.blogspot.com | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files. | |
The above copyright notice and this permission notice shall be included in all | |
copies or substantial portions of the Software. | |
*/ | |
const int DigitalOut = 8; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(DigitalOut, OUTPUT); | |
digitalWrite(DigitalOut, HIGH); | |
} | |
void loop() { | |
int RelayValue = digitalRead(DigitalOut); | |
Serial.print("RelayValue = " ); | |
Serial.print(RelayValue); | |
Serial.println(""); | |
if(RelayValue == 1) | |
digitalWrite(DigitalOut, LOW); | |
else | |
digitalWrite(DigitalOut, HIGH); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment