Created
December 24, 2017 16:08
-
-
Save skynettw/b03fffee0087cd1880f7eb515466f185 to your computer and use it in GitHub Desktop.
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
int RELAYpin = 7; | |
int PHOTOpin = A1; | |
void setup() { | |
pinMode(RELAYpin, OUTPUT); | |
digitalWrite(RELAYpin, LOW); | |
} | |
void loop() { | |
int pr = analogRead(PHOTOpin); | |
if (pr < 20) { | |
digitalWrite(RELAYpin, HIGH); | |
} else { | |
digitalWrite(RELAYpin, LOW); | |
} | |
delay(500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment