//Ryan Luis B. Dela Cruz
//G10A
//Assignment #1: Photoresistor
int pRes = A0;
const int ledPin = 13;
const int ldrPin = A0;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(ldrPin, INPUT);
}
void loop() {
int ldrStatus = analogRead(ldrPin);
if (ldrStatus <= 500)
{
digitalWrite(ledPin, HIGH);
Serial.print(" LDR Value:");
Serial.println(ldrStatus);
Serial.print("LED Status:On");
}
else
{
digitalWrite(ledPin, LOW);
Serial.print(" LDR Value:");
Serial.println(ldrStatus);
Serial.print("LED Status:Off");
}
}