← Workshop
WS-01 · Gamepad Robot
JM Digital Lab
Free Workshop · ระดับประถม 4–6 Free Workshop · Grades 4–6

ควบคุมRobot
ด้วย micro:bit
Control Robot
with micro:bit

เขียนโค้ด MakeCode ให้ micro:bit รับคำสั่ง BLE UART แล้วสั่ง robot เคลื่อนที่ตามที่ออกแบบ Write MakeCode to receive BLE UART commands from the Gamepad app and drive a robot you designed

⏱ 2–3 ชั่วโมง⏱ 2–3 hours
👦 อายุ 9–12 ปี👦 Age 9–12
🔧 ระดับเริ่มต้นBeginner
📱 Android Required📱 Android Required
🎯 เป้าหมายของ Workshop 🎯 Workshop Objective

เด็กๆ จะได้ เขียนโค้ด MakeCode บน micro:bit ให้รับคำสั่ง BLE UART จากแอป Gamepad for micro:bit — แล้วโปรแกรม robot ให้เคลื่อนที่ตามคำสั่ง ที่ออกแบบเอง ตั้งแต่คิด logic จนถึงกดปุ่มแล้ว robot ขยับจริง! Students will write MakeCode on micro:bit to receive BLE UART commands from the Gamepad for micro:bit app — then program the robot to move as designed, from thinking through the logic to pressing a button and watching the robot move!

📦 อุปกรณ์ที่ต้องเตรียม 📦 Materials Needed
  • 1
    micro:bit v2 (แนะนำ 1 ตัว/คน หรือ 2 คนต่อ 1 ตัว) micro:bit v2 (1 per student recommended, or 2 per device)
  • 2
    โทรศัพท์ Android ที่มี Bluetooth + ติดตั้งแอป Gamepad for micro:bit แล้ว Android phone with Bluetooth + Gamepad for micro:bit app installed
  • 3
    คอมพิวเตอร์ หรือแท็บเล็ต สำหรับเขียน MakeCode (makecode.microbit.org) Computer or tablet for MakeCode (makecode.microbit.org)
  • 4
    สาย USB สำหรับ flash โปรแกรมลง micro:bit USB cable to flash the program to micro:bit
  • 5
    หุ่นยนต์ robot car: Maqueen Lite / Tiny:Bit / Ringbit Car V2 (1 คัน/กลุ่ม) Robot car: Maqueen Lite / Tiny:Bit / Ringbit Car V2 (1 per group)
🧠 Computational Thinking ในบทเรียนนี้ 🧠 Computational Thinking
🧩
Decomposition
แตก robot
เป็นส่วนๆ
Break robot
into parts
command ไหนทำอะไร? robot ต้องการ input กี่อัน? Which command does what? How many inputs does the robot need?
🔁
Pattern
รูปแบบ
ของ command
Command
patterns
UP → forward, DOWN → backward, LEFT/RIGHT → เลี้ยว UP → forward, DOWN → backward, LEFT/RIGHT → turn
📐
Abstraction
ตัดสิ่งที่
ไม่จำเป็นออก
Remove
the unnecessary
robot ต้องการ command กี่อัน? จำเป็นทุกอันไหม? How many commands does the robot actually need?
📋
Algorithm
เขียนขั้นตอน
การทำงาน
Write the
steps
รับ "UP\n" → สั่ง motor → robot ขับไปข้างหน้า Receive "UP\n" → command motor → robot drives forward
⏱ ตารางเวลา Workshop ⏱ Workshop Timeline
  • 15 นาทีmin
    Phase 01 · Hook
    ลองขับ robot สำเร็จรูปก่อน Try the pre-programmed robot first
    วิทยากรสาธิต robot ที่โปรแกรมแล้ว ให้เด็กลองกด D-pad ขับจริง แล้วถามว่า "อยากเขียนโค้ดให้ robot ทำอะไรก็ได้เองไหม?" Instructor demos the pre-programmed robot — kids try the D-pad, then ask: "Want to write code that makes the robot do anything you design?"
  • 20 นาทีmin
    Phase 02 · Think
    Computational Thinking — วิเคราะห์ปัญหาร่วมกัน Computational Thinking — Analyze the problem together
    แตก logic ว่าระบบทำงานยังไง: Gamepad ส่ง BLE UART → micro:bit รับ → สั่ง motor → robot ขยับ พร้อมวาด flow บนกระดาน Break down how the system works: Gamepad sends BLE UART → micro:bit receives → commands motor → robot moves. Draw the flow on the board together.
  • 60 นาทีmin
    Phase 03 · Build
    เขียนโค้ด MakeCode + Flash + Connect Write MakeCode + Flash + Connect
    เขียน MakeCode รับ BLE UART ("UP\n", "DOWN\n", "LEFT\n", "RIGHT\n") → สั่ง motor ของ robot → Flash ลง micro:bit → เปิด Gamepad app → Scan & Connect → ทดสอบการเคลื่อนที่ Write MakeCode to receive BLE UART ("UP\n", "DOWN\n", "LEFT\n", "RIGHT\n") → command robot motors → Flash to micro:bit → open Gamepad app → Scan & Connect → test movement
  • 20 นาทีmin
    Phase 04 · Play & Share
    ขับ robot ผ่าน obstacle course! Drive robot through the obstacle course!
    เด็กๆ ขับ robot ผ่าน course ที่ครูสร้างไว้ ทดสอบว่าโค้ดทำงานถูกต้อง แชร์สิ่งที่อยากปรับปรุง และเพิ่ม feature พิเศษ (เช่น บีบแตร, LED pattern) Students drive the robot through the instructor's course, test if code works correctly, share improvements, and add special features (e.g., horn sound, LED pattern)
💬 คำถามสะท้อนคิด (หลัง Workshop) 💬 Reflection Questions (after Workshop)
  • Q1
    แอป Gamepad ส่งข้อความอะไรไป micro:bit เมื่อกด UP? และเมื่อกด LEFT? (ตอบเป็น text จริงๆ) What text does the Gamepad app send to micro:bit when UP is pressed? And LEFT? (answer with the actual string)
  • Q2
    Input → Process → Output ในระบบ BLE Robot ของเราคืออะไร? ยกตัวอย่างให้ชัดเจน What are Input → Process → Output in our BLE Robot system? Give a specific example.
  • Q3
    ตอน Bluetooth ไม่เชื่อมต่อ เราแก้ปัญหายังไง? เหมือนกับการ debug โค้ดอย่างไร? When Bluetooth wouldn't connect, how did you solve it? How is that similar to debugging code?
  • Q4
    ถ้าอยากให้ robot ทำสิ่งพิเศษเมื่อกดปุ่ม A (เช่น บีบแตร หรือ LED pattern) จะเพิ่มโค้ดตรงไหนใน MakeCode? If you want the robot to do something special when button A is pressed (e.g., horn or LED pattern), where in MakeCode would you add the code?
ESC · คลิกปุ่ม 📺 อีกครั้งเพื่อออก · L = สลับภาษา