กลับไปหน้ารวมไฟล์
arduino-lcd-game-on-tinkercad-circuits-922963.md

Arduino LCD Game บน TinkerCad Circuits

นี่คือเกมง่ายๆ ที่ผมสร้างขึ้นบน TinkerCad Circuits. นี่คือเกม stickman ที่สร้างขึ้นด้วยขั้นตอนง่ายๆ ไม่กี่ขั้น...

  • ขั้นแรก ให้เลือก Arduino ในประเภทคอมโพเนนต์ แล้วลาก Arduino พร้อม breadboard เข้ามาในพื้นที่ทำงาน จากนั้น ให้เปลี่ยนตำแหน่งของ breadboard ไปทางขวา และวาง potentiometer กับ push button ลงบน breadboard เลือก LCD แล้ววางไว้ใต้ breadboard ตามที่แสดงในรูปภาพ
  • คลิกที่ปุ่ม Code เหนือพื้นที่ทำงาน จากนั้นเลือก text ในช่องเหนือโค้ดที่เขียนไว้แล้ว ลบโค้ด "C" ที่เขียนไว้แล้ว และแทนที่ด้วยโค้ดที่แนบมา

คลิกที่ "Start Simulation" ทางขวาของปุ่ม Code และคลิกที่ push button เพื่อเล่นเกม...

หากต้องการดูโปรเจกต์ของผม คลิก here และกดไลก์ให้ด้วยนะ...

รายละเอียดทางเทคนิคเพิ่มเติม

การวิเคราะห์เอนจินเกมเสมือนจริง

การสร้างเกมที่ใช้ฮาร์ดแวร์ขึ้นใหม่ในสภาพแวดล้อมจำลอง ช่วยให้สามารถทดสอบ game logic ได้อย่างรวดเร็ว โดยไม่มีความเสี่ยงจาก wiring errors

  • การตั้งค่า Virtual HMI: มี 16x2 LCD เสมือนจริง และ potentiometer สำหรับการเคลื่อนไหวของผู้เล่น Tinkercad codeblocks หรือโค้ด C++ จะจัดการ frame-refresh rate
  • การคำนวณการชน (Collision Math): ใช้เทคนิค "Bitmasking" บน character LCD; เมื่อ "Player" character $(X, Y)$ เคลื่อนที่ โค้ดจะตรวจสอบว่าตำแหน่ง grid ถัดไปถูกครอบครองโดย "Obstacle" character หรือไม่

ประโยชน์ของการจำลอง

  • การดีบัก Logic: ช่วยให้นักเรียนสามารถเห็นภาพ millis() timing loops และ variable states ได้แบบเรียลไทม์ ซึ่งเป็นการสร้างพื้นฐานทางทฤษฎีที่แข็งแกร่งก่อนที่จะสร้างเกม breadboard จริง

ข้อมูล Frontmatter ดั้งเดิม

title: "Arduino LCD Game on TinkerCad Circuits"
description: "Play the game and have fun!"
author: "AnniBot"
category: ""
tags:
  - "games"
views: 17499
likes: 16
price: 1120
difficulty: "Intermediate"
components:
  - "1x Switch Actuator, Head for spring return push-button"
  - "1x Arduino UNO"
  - "1x Breadboard (generic)"
  - "1x RGB LCD Shield Kit, 16x2 Character Display"
  - "2x Single Turn Potentiometer- 10k ohms"
  - "1x Multitool, Screwdriver"
tools: []
apps:
  - "1x Tinkercad Codeblocks"
  - "1x Arduino IDE"
downloadableFiles:
  - "https://projects.arduinocontent.cc/9304ae52-3daa-4c7f-a908-0e2b33528fc5.ino"
documentationLinks: []
passwordHash: "5fb55e7408d2b04f32b415cff5ebbd2cc2718d8c674b84f9b0779413456605d8"
encryptedPayload: "U2FsdGVkX1+YIV9OBot69lAhGw3J9yz7pvyhQuIdvgGvY8/L/j9Oi96foS8j3X8chIh7r5RF2sdlnOncdYqx8u7DlQ3YJsU5MbQ8DvdXF2PM3pY1ciniV8tLF2rtqFoy"
seoDescription: "Create an Arduino LCD Game on TinkerCad Circuits. Learn to code and enjoy playing the game!"
videoLinks:
  - "https://player.vimeo.com/video/497694920"
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/arduino-lcd-game-on-tinkercad-circuits-922963_cover.png"
lang: "th"