Sinple program that reads the light levels from the LDR and will turn an LED if it is dark and off if it is light:
int reading;
void setup() {
pinMode(13,OUTPUT);
Serial.begin(9600);
}
void loop() {
reading = analogRead(0);
if (reading < 200) {digitalWrite(13,1);}
else
{digitalWrite(13,0);}
}
Monday, March 1, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment