กลับไปหน้ารวมไฟล์
uno-wifi-r4-matrix-dice-fc6716-en.md

Integrated Graphics: UNO R4 Matrix Dice

The UNO R4 Matrix Dice project showcases the power of the newest generation of Arduino boards. By using the built-in 12x8 LED matrix, you don't need any external displays or messy wiring to build a functioning digital game.

arduino_memory_game_topview_1772681131358.png

Designing the Matrix Frames

To show numbers 1 through 6, you must draw them first.

  1. You use the online Arduino Matrix Editor to click on the 12x8 pixel grid, drawing a single dot for '1', two diagonal dots for '2', etc.
  2. The editor generates Hexadecimal arrays (e.g., uint32_t dice_frame_1[] = {0x...}). You paste these arrays into your sketch.
  3. When the user presses a button, the Arduino generates a random number and loads the corresponding frame: matrix.loadFrame(dice_frame_4).

Required Hardware

  • Arduino UNO R4 WiFi: The board with the built-in matrix.
  • Push Button: To trigger the "Roll".
  • 10k-ohm Pulldown Resistor.

True Randomness

To ensure the dice doesn't roll the exact same sequence every time you turn the board on, you use the randomSeed(analogRead(A0)) function in the setup(). This reads the fluctuating electrical noise from an empty analog pin to scramble the random number generator!

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

title: "UNO WIFI R4 Matrix Dice"
description: "A digital roll of the dice! Utilize the built-in LED matrix on the modern Arduino UNO R4 to create a perfectly randomized electronic die."
category: "Games & Toys"
difficulty: "Easy"