Navigasi Materi

Makecode Micro:bit #6 - Shake Play to Music

📳 Shake to Play Music

Accelerometer → Event → Sound & Response
Goyangkan micro:bit dan dengarkan musiknya! 🎵

🎯 Learning Goal / Tujuan Pembelajaran

English: Students understand how the accelerometer can detect a shake event and trigger a response.

Indonesia: Siswa memahami bagaimana accelerometer mendeteksi gerakan menggoyangkan micro:bit dan memicu suatu respons.

💡 How It Works / Cara Kerjanya

English: When the micro:bit detects a shake, the program responds.

Indonesia: Ketika micro:bit mendeteksi gerakan shake, program memberikan respons.

on shake
play melody 🎵
show icon 🎵
pause 1 second

English: Shake is an event. The accelerometer detects the movement.

Indonesia: Shake adalah sebuah event. Accelerometer mendeteksi gerakan tersebut.

🎮 Simulator / Simulasi

🙂
🎵〰️🎵〰️🎵

Press RUN to start the program.
🔊 Sound: Press SHAKE! to hear the sound from your browser.
Browser biasanya hanya mengizinkan suara setelah ada interaksi langsung dari pengguna.

🧠 Practice / Latihan

English: Which block detects that the micro:bit is being shaken?

Indonesia: Block manakah yang mendeteksi bahwa micro:bit sedang digoyangkan?

🏆 Challenge 1 — Make It Play!

English: Press RUN, then press SHAKE!. The micro:bit should react and play a sound.

Indonesia: Tekan RUN, lalu tekan SHAKE!. Micro:bit harus memberikan respons dan memainkan suara.

🏆 Challenge 2 — Think Like a Programmer

English: Which component detects the shaking movement?

Indonesia: Komponen apa yang mendeteksi gerakan menggoyangkan micro:bit?

🏆 Challenge 3 — Change the Response

English: Imagine you want the micro:bit to show a ❤️ after shaking. Which block should you change?

Indonesia: Bayangkan setelah digoyangkan micro:bit harus menampilkan ❤️. Block manakah yang harus diubah?

🔬 Now Try It with a Real micro:bit!

English: Now build the same program in Microsoft MakeCode and download it to your real micro:bit.

Indonesia: Sekarang buat program yang sama di Microsoft MakeCode dan download program tersebut ke micro:bit sungguhan.

  1. Open on shake.
  2. Add play melody.
  3. Add show icon.
  4. Test the program in the MakeCode simulator.
  5. Download it to your real micro:bit.
  6. Shake your micro:bit and listen! 🎵
🚀 Open Microsoft MakeCode for micro:bit

🌟 What Did You Learn?

Input: Accelerometer detects shaking.

Process: The program detects the on shake event.

Output: Music plays and the screen shows 🎵.

Accelerometer → Event → Sound → Response 🎵