Created
May 13, 2018 16:19
-
-
Save arduinothai/6fa7991f9e557db75f9ebba186a2e899 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 SensorPin = 2; | |
int value; | |
void setup(void) { | |
Serial.begin(9600); | |
pinMode(SensorPin,INPUT); | |
} | |
void loop(void) { | |
value = digitalRead(SensorPin); | |
Serial.print("Analog reading = "); | |
Serial.println(value); | |
if (value == 0) | |
{ | |
Serial.println(" - Very bright"); | |
} | |
else | |
{ | |
Serial.println(" - Dark"); | |
} | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment