Navigasi Materi

Makecode MIkro:bit #10 - Night Light

MakeCode micro:bit Lab #10 - Night Light

🌙 MakeCode micro:bit Lab #10 — Night Light

English: Use a light sensor to control a lamp automatically.

Indonesia: Gunakan sensor cahaya untuk mengendalikan lampu secara otomatis.

Sensor → Condition → Output

💡 Simulator / Simulasi

AB
OFF
0123VGND
💡
30 / 255
Light Level / Tingkat Cahaya
Dark / GelapBright / Terang
Press RUN to activate the automatic light.
Rule: if light level < 80, the lamp turns ON.

📊 Results / Hasil

0
🌙
Dark Readings
Cahaya rendah
OFF
💡
Lamp State
Status lampu
0
🔄
Changes
Perubahan

💡 Cara Bermain / How to Play

1
Tekan RUN.
Press RUN.
2
Geser Light Level ke bawah 80.
Move Light Level below 80.
3
Amati lampu menyala. Naikkan cahaya di atas 80 dan amati lampu mati.
Watch the lamp turn on. Raise the light above 80 and watch it turn off.
Program membuat keputusan berdasarkan kondisi cahaya.
The program makes a decision based on the light condition.

🎯 Tujuan Pembelajaran / Learning Goal

Memahami konsep sensor cahaya.
/ Understand a light sensor.
Menggunakan kondisi if...then...else.
/ Use an if...then...else condition.
Menghubungkan input sensor dengan output otomatis.
/ Connect sensor input to an automatic output.

🚀 Coba di micro:bit sungguhan!

Try it with a real micro:bit!

Buat lampu malam otomatis menggunakan light level di Microsoft MakeCode.
Create an automatic night light using light level in Microsoft MakeCode.

↗ Open Microsoft MakeCode for micro:bit →

Official MakeCode: makecode.microbit.org

📊 Koneksi dengan Matematika

Math Connection

Nilai sensor dapat dibandingkan dengan batas tertentu, misalnya 80.

A sensor value can be compared with a threshold, such as 80.

🧩 Program / Program

English: The micro:bit reads the light level and decides whether the lamp should be ON or OFF.

Indonesia: micro:bit membaca tingkat cahaya lalu menentukan apakah lampu harus ON atau OFF.

forever if light level < 80 then turn lamp ON else turn lamp OFF

Key idea:

IF light level < 80 → Lamp ON

🧠 Practice / Latihan

Question / Pertanyaan:

If the light level is 40, what should the automatic lamp do?

Jika tingkat cahaya adalah 40, apa yang harus dilakukan lampu otomatis?

🏆 Challenges / Tantangan

Challenge 1 — Make the Night Light Work

Press RUN and set the light level below 80. The lamp should turn ON.
Indonesia: Tekan RUN dan atur cahaya di bawah 80. Lampu harus menyala.

Challenge 2 — Think Like a Programmer

Which part of the program makes the decision?
Bagian program mana yang membuat keputusan?

Challenge 3 — Change the Threshold

Suppose the lamp should turn ON when the light level is below 100. What number should replace 80?

Indonesia: Jika lampu harus menyala saat cahaya di bawah 100, angka berapa yang menggantikan 80?

📐 Math Connection / Hubungan dengan Matematika

Contoh: jika sensor membaca 40, maka:

40 < 80 → Lamp ON

Jika sensor membaca 120:

120 < 80 → false → Lamp OFF

Aktivitas ini dapat dikembangkan menjadi materi tentang perbandingan, pertidaksamaan, interval, dan pengambilan keputusan.