Arduino, Cpp.
Follow the electronic schematic: And now the code below: int ledPort = 10; // Port to be used to turn on the LED int ldrPort = A5; // Analog port used by the LDR void setup() { pinMode(ledPort, OUTPUT); // Set the LED port as output } void loop() { int state = analogRead(ldrPort); // Read the value