Skip to content

Instantly share code, notes, and snippets.

@SimedruF
Last active January 2, 2022 19:38
Show Gist options
  • Save SimedruF/3e06f0a6cfa7f59ad6fe47e0ea8c2b6f to your computer and use it in GitHub Desktop.
Save SimedruF/3e06f0a6cfa7f59ad6fe47e0ea8c2b6f to your computer and use it in GitHub Desktop.
Arduino_relay.ino
/*
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