Navigasi Materi

Makecode Micro:bit #9

MakeCode micro:bit Lab #9 - Digital Counter

🔢 MakeCode micro:bit Lab #9 — Digital Counter

English: Use a variable to count button presses.

Indonesia: Gunakan variabel untuk menghitung berapa kali tombol ditekan.

Input → Variable → Counting

🔢 Simulator / Simulasi

AB
0
0123VGND
0
Current Count / Nilai Hitungan
Press RUN to begin.
Rule: Button A adds 1 to the variable. Button B resets the variable to 0.
Tombol A menambah 1. Tombol B mengembalikan hitungan ke 0.

📊 Results / Hasil

0
👆
A Presses
Tekanan A
0
🔝
Highest
Tertinggi
0
🔄
Resets
Reset B

💡 Cara Bermain / How to Play

1
Tekan RUN untuk mengaktifkan program.
Press RUN to activate the program.
2
Tekan A beberapa kali dan amati angka.
Press A several times and watch the number.
3
Tekan B untuk mengembalikan hitungan ke 0.
Press B to reset the count to 0.
Variabel menyimpan nilai yang dapat berubah selama program berjalan.
A variable stores a value that can change while the program runs.

🎯 Tujuan Pembelajaran / Learning Goal

Memahami fungsi variable.
/ Understand variables.
Mengubah nilai variabel dengan input tombol.
/ Change a variable using button input.
Menghubungkan program dengan proses menghitung.
/ Connect programming with counting.

🚀 Coba di micro:bit sungguhan!

Try it with a real micro:bit!

Buat penghitung sederhana menggunakan tombol A dan B di Microsoft MakeCode.
Create a simple counter using buttons A and B in Microsoft MakeCode.

↗ Open Microsoft MakeCode for micro:bit →

Official MakeCode: makecode.microbit.org

📊 Koneksi dengan Matematika

Math Connection

Counter dapat digunakan untuk menghitung frekuensi, banyak benda, atau jumlah kejadian.

A counter can be used to count frequency, objects, or events.

🧩 Program / Program

English: The variable count stores the number of times Button A is pressed.

Indonesia: Variabel count menyimpan jumlah berapa kali Tombol A ditekan.

on start set count to 0 on button A pressed change count by 1 show number count on button B pressed set count to 0 show number count

Key idea:

count = count + 1

🧠 Practice / Latihan

Question / Pertanyaan:

If count = 4 and Button A is pressed once, what is the new value of count?

Jika count = 4 dan Tombol A ditekan satu kali, berapakah nilai count sekarang?

🏆 Challenges / Tantangan

Challenge 1 — Count to 10

Press RUN, then press A exactly 10 times. Check your result.
Indonesia: Tekan RUN, lalu tekan A tepat 10 kali.

Challenge 2 — Think Like a Programmer

Which block changes the value of a variable by adding 1?
Blok mana yang mengubah nilai variabel dengan menambahkan 1?

Challenge 3 — Change the Rule

Imagine Button A should add 2 instead of 1. Which value should replace 1 in change count by 1?

Indonesia: Jika Tombol A harus menambah 2, angka berapa yang menggantikan 1?

📐 Math Connection / Hubungan dengan Matematika

Jika tombol A ditekan 7 kali, maka nilai counter menjadi:

0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 7

Konsep ini dapat dikembangkan menjadi kegiatan matematika tentang frekuensi, tabel pencatatan, dan pola perubahan nilai.

This idea can be extended to frequency, data tables, and patterns of change.