Hi! I’m in need of help getting done for this project.
So basically I’m doing a small project on Dark Sensor , using TinkerKit LDR. However , I had some issues as I didn’t know how to connect it. ( I’m not sure if my codes are correct or not).
Requested my lecturer for a normal LDR but he didn’t give me. Would appreciate if someone can help!
Here are the codes that I’m bascially using
int sensorPin = A0; // select the input pin for the ldr
unsigned int sensorValue = 0; // variable to store the value coming from the ldr
//Start Serial port
Serial.begin(9600); // start serial for output - for testing
// read the value from the ldr:
sensorValue = analogRead(sensorPin);
if(sensorValue<400) digitalWrite(8, HIGH); // set the LED on
else digitalWrite(8, LOW); // set the LED on