انتقل للمحتوى
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

A door with a button

Section 4: Sound and movementLesson 4.3 · ⏱ 8 min
🧩 The door
Blocks: loop — repeats forever
🖥️ What happens on the stage?
As long as the button is pressed the door opens (90), and when you let go it closes (0).

📌 Another example: a half-open door

When pressed, the door opens halfway (45), and when not pressed it closes (0).

🧩 A half-open door
Blocks: loop — repeats forever
The door is open
The door is open
✍️ Practise
Build the door.
✍️ Practise here in the lessonor open the lab in a new page ↗

🎯 Challenge yourself

Easy

When pressed, the door opens to 180.

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

Result: fully open.

Medium

One press: the door opens for 3 seconds, then closes by itself.

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

Result: open, then it closes.

Hard

The opposite: the door is always open, and pressing closes it.

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

Result: open, and closed when pressed.

Finished the lesson? Mark it so your progress counts.