Arduino Projects Ideas - Digital Dice (7-segment Display)
Components:
7-segment display (common cathode)
8× 220Ω resistors
Push button
Arduino UNO
Wiring:
Connect A-G segments to pins 2–8
Common cathode to GND
Button to pin 9 with pull-down resistor
Code (sample for one digit):
const byte segments[] = {2,3,4,5,6,7,8};
const byte dice[6][7] = {
{1,1,1,1,1,1,0}, // 0
{0,1,1,0,0,0,0}, // 1
{1,1,0,1,1,0,1}, // 2
{1,1,1,1,0,0,1}, // 3
{0,1,1,0,0,1,1}, // 4
{1,0,1,1,0,1,1} // 5
};
void setup() {
for(int i=0; i<7; i++) pinMode(segments[i], OUTPUT);
pinMode(9, INPUT);
}
void loop() {
if(digitalRead(9) == HIGH){int num = random(6);for(int i=0; i<7; i++) digitalWrite(segments[i], dice[num][i]);delay(500);
}
}
Pages
- Web-Based Projects
- Mobile Application Projects
- Database Management Projects
- Software for Data Analytics Projects
- Cloud Computing Projects
- Cybersecurity Projects
- Game Development Projects
- Artificial Intelligence (AI) Projects
- Machine Learning (ML) Projects
- Data Science Projects
- Augmented/Virtual Reality (AR/VR) Projects
- Blockchain Projects
- Arduino Projects
- Arduino Projects (IoT)
- Fortinet
- Mikrotik