Created
May 21, 2015 09:25
-
-
Save Bouhnosaure/18cab1baf3bfa2342ab2 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 photocellPin = 0; // the cell and 10K pulldown are connected to a0 | |
int photocellReading; // the analog reading from the analog resistor divider | |
void setup(void) { | |
// We'll send debugging information via the Serial monitor | |
Serial.begin(9600); | |
} | |
void loop(void) { | |
photocellReading = analogRead(photocellPin); | |
/*Serial.print("Analog reading = ");*/ | |
Serial.println(photocellReading); // the raw analog reading | |
// We'll have a few threshholds, qualitatively determined | |
/* if (photocellReading < 10) { | |
Serial.println(" - Noir"); | |
} else if (photocellReading < 200) { | |
Serial.println(" - Sombre"); | |
} else if (photocellReading < 500) { | |
Serial.println(" - Lumiere"); | |
} else if (photocellReading < 800) { | |
Serial.println(" - Lumineux"); | |
} else { | |
Serial.println(" - Tres lumineux"); | |
}*/ | |
delay(500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment