Connecting TinkerKit LDR to Arduino UNO

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! :slight_smile:
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

void setup()
{
pinMode(8, OUTPUT);
//Start Serial port
Serial.begin(9600); // start serial for output - for testing
}

void loop()
{
// 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

// For DEBUGGING - Print out our data, uncomment the lines below
//Serial.print(sensorValue, DEC); // print the value (0 to 1024)
//Serial.println(""); // print carriage return
//delay(500);
}

We don’t know how you connected it… Only connecting it to A0 will not work. It need GND and 5V as well.