انتقل للمحتوى
Robo EgyptRobo Egypt
☰ Course contents
Robo Maker: home
0. Lab tour1
1. The start: the Arduino6
2. Wiring and the traffic light4
3. Inputs: the button4
4. Sound and movement5
5. Sensors and numbers5
6. Distance, the screen and colours5
7. Motors and the car4
8. The project: the city's smart gate3
9. From blocks to C++ code5
10. Sensors and screens in code5
11. Smart systems5
12. Bluetooth: control from the phone1

The light sensor: the street lamp

Section 5: Sensors and numbersLesson 5.3 · ⏱ 8 min

The light sensor (LDR) gives a small number in the dark and a big number in the light. We compare it with a limit number like 300.

🧩 The street lamp
Blocks: loop — repeats forever
🖥️ What happens on the stage?
When it gets dark (a number below 300), the LED turns on by itself.

📌 Another example: a darker limit

The limit is 150 instead of 300: the LED lights only when it is very dark.

🧩 A darker limit
Blocks: loop — repeats forever
A little dark (250): off
A little dark (250): off
Very dark (80): on
Very dark (80): on
✍️ Practise
Watch the light sensor.
✍️ Practise here in the lessonor open the lab in a new page ↗
✍️ Practise
Build the street lamp.
✍️ Practise here in the lessonor open the lab in a new page ↗

🎯 Challenge yourself

Easy

A daylight lamp: it lights when the light is above 600.

👀 Show the solution
🧩 Solution
Blocks: loop — repeats forever
In the lab
In the lab

Result: it lights in the light.

Medium

In the dark (below 300), the LED blinks instead of staying on.

👀 Show the solution
🧩 Solution
Blocks: loop — repeats forever
In the lab
In the lab

Result: blinking in the dark.

Hard

Print the light value on the Serial, and light up in the dark.

👀 Show the solution
🧩 Solution
Blocks: setup — runs once, loop — repeats forever
In the lab
In the lab

Result: the numbers appear, and the LED lights up.

Finished the lesson? Mark it so your progress counts.