UNIVERSITI TEKNOLOGI MARA
FACULTY Of MECHANICAL ENGINEERING
MEC 532 (APPLIED ELECTRONIC AND MICROPROCESSOR)
ARDUINO PROJECT
(ROLL THE DICE)
GROUP :
EMD6M1A
LECTURERS NAME :
DR LOW CHENG YEE
STUDENTS NAME:
MUHAMMAD SYAFIQ BIN ZAINAL (2013727129)
MOHAMMAD ZAM AZUAN BIN ABD AZIZ (2013723395)
AAEESYA BINTI MOHD AZMI (2013963757)
AFNAN HANANY BINTI YAACOB
(2013796669)
ANIS UMIRA BINTI SAIDON (2013306467)
PROBLEM STATEMENT
Regular dice, the child may take longer to play
the game.
This happens when the child needs time to count
the dot in regular dice.
To create device that can educate children
To incorporate education in games for children at
early age
OBJECTIVES:
To learn basic programming of Arduino.
To develops skill on how to a write program.
To make a game become more interesting by
using Arduino programming.
To develop the skill to become more creative
and innovative.
By using rolls the dice it is make more
parents easy to teach their children.
INTRODUCTION
The first known six-sided dice were found in Iraq
They were made of terracotta, with small holes
for the spots.
Dice were used for sorcery and to predict the
future
As time went on, however, dice were
used more and more for gambling
and playing games.
WHAT IS ELECTRONIC DICE ?
Alternative device that can be used to replace the
traditional dice when you are playing games such
as snake ladder and monopoly.
Device that will display in random the number
from 1 to 9 on the 7 segment display.
ROLL THE DICE SPECIFICATION
Function :
to display the number randomly
Category:
Main : children ( 2 y 4y )
Features :
Arduino uno
7 segment display (0-9)
Tilt sensor
CIRCUIT DIAGRAM
Figure 1
shows the
segment
labels
Figure 2
shows
what the
pin
numbers
are
Figure 3
pin 3 and 8 are to be
connected to ground,
and all the other pins
turn on a segment on
the display when
connect to a power
source.
FLOWCHART PROGGRAMMING
START
SHAKE
THE
DICE
DISPLAY
NUMBER
READ
PLAY
REPEAT
RESULT
VIDEO
Coding :
// Define the LED digit patters, from 0 - 9
// Note that these patterns are for common cathode displays
// For common anode displays, change the 1's to 0's and 0's to 1's
// 1 = LED on, 0 = LED off, in this order:
//
Arduino pin: 2,3,4,5,6,7,8
byte seven_seg_digits[10][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
{ 1, 0, 1, 1, 1, 1, 1 }, // = 6
{ 1, 1, 1, 0, 0, 0, 0 }, // = 7
{ 1, 1, 1, 1, 1, 1, 1 }, // = 8
{ 1, 1, 1, 0, 0, 1, 1 } // = 9
};
const int tiltSensorPin = 12; // the number of the tilt Sensor pin
int tiltSensorState = 0;
int count = 0;
void setup() {
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
writeDot(0); // start with the "dot" off
pinMode(tiltSensorPin, INPUT);
}
void writeDot(byte dot) {
digitalWrite(9, dot);
}
void sevenSegWrite(byte digit) {
byte pin = 2;
for (byte segCount = 0; segCount < 7; ++segCount) {
digitalWrite(pin, seven_seg_digits[digit][segCount]);
++pin;
}
void throwDice() {
writeDot(1);
for (byte count = 30; count > 0; --count) {
delay(40);
sevenSegWrite(random(1, 6));
}
writeDot(0);
}
void loop() {
tiltSensorState = digitalRead(tiltSensorPin);
if (tiltSensorState == LOW) {
count++;
delay(10);
}
if (count == 20) {
throwDice();
count = 0;
}
}
DISCUSSION
As a discussion,we found that roll the dice give some
advantages for children :
children learn basic number faster
to improvise psychomotor of children at early age
can educate children play by electronic device
easy to teach and so much fun
CONCLUSION
As conclusion, our objective achieved
We able to practice basic programming arduino
into this project
By learn this subject, we know that arduino
made some item easier to use in term of
technology
THANK YOU