Created
October 30, 2017 09:11
-
-
Save grimmdev/961ebc272fe6b01b596ff2c336c08dee to your computer and use it in GitHub Desktop.
Light Switch Arduino Sensor for Relay
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
#define LIGHT_PIN D6 // 0 = LIGHT | 1 = DARK | |
void setup() { | |
Serial.begin(9600); | |
} | |
void loop() { | |
Serial.println(light()); | |
} | |
int light() | |
{ | |
pinMode(LIGHT_PIN, INPUT); | |
return digitalRead(LIGHT_PIN); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment