ชื่อโปรเจกต์: Electronic Dice using Touch Sensor and 7 Segment Display
ในโปรเจกต์นี้ เราจำลองลูกเต๋าโดยใช้ touch sensor ทุกครั้งที่แตะ touch sensor ตัวเลขสุ่มระหว่าง 1 ถึง 6 จะถูกสร้างขึ้นและแสดงบน 7-Segment LED
หัวใจหลักของโปรแกรมคือ `randomSeed()` ซึ่งจะถูกเริ่มต้นด้วยอินพุตแบบสุ่มจาก `analogRead()` บนขาที่ไม่ได้เชื่อมต่อ
และเพื่อเพิ่มความสนุกสนาน ยังมีตัวสร้างรูปแบบรวมอยู่ด้วยสำหรับการ "ทอย" ลูกเต๋าทุกครั้ง!
ลูกเต๋าอิเล็กทรอนิกส์โดยใช้ Touch Sensor และ Arduino
รายละเอียดทางเทคนิคเพิ่มเติม
การสร้างตัวเลขสุ่ม
ลูกเต๋าอิเล็กทรอนิกส์นี้จำลองการทอยลูกเต๋าแบบกายภาพโดยใช้ motion sensing
- การกระตุ้น: Tilt Sensor (แบบปรอทหรือลูกกลิ้ง) ตรวจจับท่าทาง "Shake" เมื่อถูกเขย่า Arduino จะเข้าสู่ลูปสุ่มความเร็วสูง
- ตรรกะ Seed: ใช้ฟังก์ชัน
random() ซึ่งถูก seed ด้วยสัญญาณรบกวนบน analog pin ที่ไม่ได้เชื่อมต่อ เพื่อให้มั่นใจถึงความไม่แน่นอนที่แท้จริง
การแสดงผลด้วยภาพ
- การแสดงผล: ผลลัพธ์ (1-6) จะแสดงบน Large 7-Segment LED Display โดย Arduino จะจัดการตรรกะแบบ common-cathode หรือ common-anode เพื่อให้ส่วนที่ถูกต้องสว่างขึ้น
- Persistence of Vision: ขณะที่กำลัง "ทอย" จอแสดงผลจะกะพริบอย่างรวดเร็วเพื่อจำลองความไม่แน่นอน ก่อนที่จะหยุดที่ตัวเลขสุดท้าย พร้อมกับเสียงบี๊บสั้นๆ เพื่อเพิ่มอรรถรส
ข้อมูล Frontmatter ดั้งเดิม
title: "Electronic Dice using Touch Sensor and 7 Segment Display"
description: "When the Touch Sensor is tapped, the Arduino is programmed to generate a random number between 1 and 6. This number is shown on the display."
author: "shreyas_arbatti"
category: ""
tags:
- "electronic dice"
- "display"
- "electronic dice using arduino"
views: 18405
likes: 1
price: 1120
difficulty: "Easy"
components:
- "1x Resistor 1k ohm"
- "1x Touch Sensor"
- "1x 7 Segment LED Display, Red"
- "1x Breadboard Connectors"
- "1x Jumper wires (generic)"
- "1x Breadboard (generic)"
- "1x Arduino UNO"
tools: []
apps:
- "1x Arduino IDE"
downloadableFiles: []
documentationLinks: []
passwordHash: "06e50c4dac8c25a4d4b18b8ad5338e2c06844a88d53cec33f9dbbdd94f38d5fe"
encryptedPayload: "U2FsdGVkX18FqhgSvWtxn/3ccNLjFENkECHnKwhlba5rZjHqiNeyfwoqBwA1xLGHiWPCMyF15QQsxrFDjlPpHsV7KRimyUr/KsJ2Jq812NBsxAXK0WnpPy26BXbLnlR2QvUd2OJljyphAz4BSSspxlIN8/a8AihQXG05SYDoo9z9FssmqUcxAVeb90bC8YMwrqc30POwYZLDUCn366j5ZvPT2gJJdACUIq8Y/tk9zJ+mBRLfl6J9/3ChJd+xEmLY"
seoDescription: "Build an Electronic Dice with Arduino, Touch Sensor, and 7 Segment Display. Learn to generate random numbers and display results easily."
videoLinks:
- "https://www.youtube.com/embed/O9nwD4egouQ"
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/electronic-dice-using-touch-sensor-and-7-segment-display-27297a_cover.jpg"
lang: "th"