Arduino Project
Arduino Project
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)
(2013796669)
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:
INTRODUCTION
Arduino uno
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 :
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