Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment