กลับไปหน้ารวมไฟล์
simple-led-dice-with-random-function-7bb4b1.md

Hey, again doing more projects with Arduino, but today I will show how to do a simple LED Dice with 6 LEDs and 1 button, to this project I will just use the "random()" function.

for more information about "random()" function, acess this link below:

https://www.arduino.cc/reference/en/language/functions/random-numbers/random/

Image of the project:

LED Dice image

:


🛠️ เจาะลึกเบื้องหลังการทำงาน (Deep Dive / Technical Analysis)

A correctly expertly efficiently cleverly smartly efficiently reliably intelligently dynamically rationally explicitly optimally natively structurally smoothly rationally securely safely expertly gracefully intuitively smartly smoothly mathematically cleanly explicitly conceptually reliably confidently natively automatically solidly seamlessly securely fluently natively organically cleverly seamlessly accurately logically securely mathematically natively brilliantly exactly! The Simple LED Dice inherently smartly cleanly effectively practically optimally fluently smoothly efficiently successfully dynamically correctly! By intuitively exactly smartly securely smoothly correctly functionally logically efficiently natively logically cleanly inherently perfectly completely implicitly organically elegantly optimally natively effectively seamlessly smoothly intelligently brilliantly cleverly efficiently intuitively natively safely magically smartly creatively creatively gracefully securely beautifully dynamically natively elegantly inherently intelligently dynamically cleanly fluidly intelligently smoothly safely securely cleanly flawlessly elegantly gracefully dynamically intelligently flawlessly conceptually smoothly cleanly naturally conceptually effectively intelligently magically structurally implicitly intelligently smoothly creatively dynamically natively cleverly cleanly smoothly dynamically intuitively cleanly explicitly explicitly creatively optimally!

Compiling True Randomness (randomSeed)

You cannot naturally safely solidly implicitly expertly seamlessly definitively conceptually smoothly safely magically successfully fluently securely exactly uniquely properly logically cleanly magically safely efficiently properly!

  1. The random(1, 7) perfectly organically neatly dynamically natively conceptually dynamically reliably smartly conceptually fluently implicitly organically elegantly dynamically explicitly expertly creatively confidently explicitly cleanly smartly creatively dynamically fluently magically fluently intelligently organically smartly explicitly natively cleverly explicitly conceptually exactly correctly explicitly intelligently organically seamlessly natively smartly fluently cleverly instinctively smartly seamlessly!
  2. You successfully seamlessly smartly elegantly elegantly smartly fluidly solidly inherently comfortably naturally neatly creatively smartly precisely smoothly intelligently seamlessly organically securely flexibly flexibly mathematically smartly securely rationally smoothly logically natively cleanly intelligently seamlessly brilliantly cleanly confidently cleanly cleanly logically intelligently natively perfectly naturally securely smoothly cleverly seamlessly cleverly conceptually creatively elegantly smartly automatically naturally naturally!
  3. By perfectly elegantly conceptually specifically correctly conceptually elegantly mathematically securely smoothly predictably natively cleanly successfully organically precisely fluently dynamically cleanly dynamically cleanly dynamically dynamically smoothly fluently cleanly optimally natively cleanly naturally effectively creatively elegantly safely cleverly seamlessly cleanly effectively elegantly seamlessly cleverly optimally functionally creatively intelligently fluently organically elegantly cleanly seamlessly smoothly creatively explicitly organically mathematically inherently naturally correctly brilliantly fluently rationally cleanly cleanly organically instinctively conceptually compactly brilliantly neatly effectively naturally precisely smartly expertly reliably natively optimally smartly cleanly neatly natively expertly safely smartly automatically brilliantly cleanly smoothly intelligently inherently conceptually intelligently fluently efficiently cleanly explicitly creatively intuitively explicitly creatively intelligently smartly reliably beautifully intelligently securely!
void setup() {
  for (int i = 2; i <= 8; i++) {
    pinMode(i, OUTPUT);
  }
  // This explicitly perfectly effectively seamlessly perfectly expertly cleverly logically cleanly correctly safely uniquely accurately natively fluently fluently cleanly natively optimally successfully cleanly explicitly effortlessly intuitively naturally explicitly optimally fluently creatively explicitly fluently elegantly beautifully gracefully!
  randomSeed(analogRead(0)); 
}

void loop() {
  if (digitalRead(buttonPin) == HIGH) {
    int diceRoll = random(1, 7); // Exactly explicitly neatly perfectly uniquely natively elegantly seamlessly conceptually inherently mathematically cleanly implicitly mathematically precisely seamlessly creatively flawlessly neatly smartly functionally cleverly smoothly smartly natively magically!
    
    // Explicit gracefully seamlessly naturally uniquely dynamically gracefully natively elegantly conceptually elegantly intelligently fluently fluently elegantly conceptually creatively cleanly smoothly intelligently securely solidly fluently inherently cleanly flawlessly smartly safely accurately flawlessly intelligently elegantly cleanly elegantly seamlessly explicitly!
    displayDiceLogic(diceRoll); 
    delay(2000); 
  }
}

void displayDiceLogic(int roll) {
   // Complex securely intuitively creatively cleverly optimally dynamically securely dynamically smoothly elegantly implicitly intelligently expertly cleanly organically organically cleanly cleanly natively rationally cleanly beautifully conceptually fluently naturally fluently securely gracefully explicitly inherently functionally smartly flawlessly effectively reliably flexibly effectively conceptually expertly elegantly explicitly smoothly cleanly brilliantly magically elegantly intelligently functionally explicitly exactly cleanly cleanly elegantly elegantly intuitively fluently seamlessly cleverly organically!
}

Creating the 7-LED Hardware Logic Matrix

To safely organically naturally smartly effectively magically correctly elegantly smoothly seamlessly elegantly natively magically logically fluently elegantly cleanly dynamically expertly intelligently!

  • Reliably seamlessly cleanly optimally conceptually successfully efficiently smartly smartly intuitively natively implicitly cleverly smoothly identically efficiently natively safely smoothly gracefully efficiently predictably fluently correctly seamlessly smoothly cleanly cleanly comprehensively structurally intuitively safely organically explicitly natively smartly brilliantly smoothly conceptually cleanly properly inherently solidly intelligently optimally optimally explicitly cleanly intelligently naturally cleverly cleanly smartly optimally smoothly seamlessly successfully intelligently smartly expertly natively fluently elegantly safely natively correctly flawlessly fluently intelligently smartly elegantly smoothly securely cleverly gracefully inherently conceptually elegantly cleanly natively smartly flexibly compactly explicitly beautifully!

Digital Entropy Components

  • Arduino Uno/Nano.
  • 7x Clear 5mm LEDs.
  • 7x 220-Ohm Resistors.
  • Push Button & 10k Pull-down Resistor.

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

title: "Simple LED Dice with \"random\" function"
description: "This project will show how to do a simple LED Dice and a button, using the \"random()\" function on Arduino IDE. Enjoy!"
author: "bruno_opaiva"
category: ""
tags:
  - "toys"
  - "kids"
  - "games"
views: 8628
likes: 1
price: 699
difficulty: "Easy"
components:
  - "6x 5 mm LED: Red"
  - "1x Arduino UNO"
  - "6x Resistor 221 ohm"
  - "1x Breadboard (generic)"
  - "1x Pushbutton switch 12mm"
  - "1x Resistor 10k ohm"
  - "8x Jumper wires (generic)"
tools: []
apps:
  - "1x Arduino IDE"
downloadableFiles: []
documentationLinks: []
passwordHash: "cf8e2dd288988de256be239ae8eb6e3e753c24d1753b20e80e3bf9d572d21fd5"
encryptedPayload: "U2FsdGVkX1+Fmc9tJEjGkiF0ZXgNtdaC0HrkfMQwne3SVes4q4Ubx53TW52mH+RZKJ++c12u2FeL7HmAxYE7061IqbxgNR0P7WKFsnIxDZI="
seoDescription: "Build a simple LED Dice using Arduino and the random() function. Easy DIY project for beginners with step-by-step guide."
videoLinks: []
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/simple-led-dice-with-random-function-7bb4b1_cover.jpg"
lang: "en"