Electronic Dice for Kids

471

3

Introduction: Electronic Dice for Kids

I am an Engineering student. I am doing my BE in AAA college of engineering and technology.

This instructable will show you how to create a dice using Arduino and few components. It's an easy and fun project for kids, suitable for beginners and those who want to start with Arduino; it also requires a minimal amount of components.

Step 1: Components:

1)Arduino Uno X 1

2)LEDs X 7

3)1K resistors X 4

4)Switches X 4

5)PCB board X 1

6)Wires

TOOLS:

1)Soldering iron

2)Lead

3)Paste

Step 2: Circuit Diagram:

To create all the six faces of a dice, you need 7 LEDs, placed in the shape of an "H".As you can see from the diagram, they're not all linked to different pins of Arduino, but most are connected in pairs, to facilitate the use.

To create all the faces of the dice, you must follow these rules: For the number 1 of the dice: lights up the led 4For the number 2 of the dice: lights up the group 1For the number 3 of the dice: lights up the groups 3 and 4For the number 4 of the dice: lights up the groups 1 and 3For the number 5 of the dice: lights up the groups 1, 3 and 4For the number 6 of the dice: lights up the groups 1, 2 and 3

Step 3: Program:

int pinLeds1 = 10;

int pinLeds2 = 9;

int pinLeds3 = 7;

int pinLed4 = 8;

int buttonPin = 6;

int buttonState;

long ran;

int time = 2000;

void setup ()

{

pinMode (pinLeds1, OUTPUT);

pinMode (pinLeds2, OUTPUT);

pinMode (pinLeds3, OUTPUT);

pinMode (pinLed4, OUTPUT);

pinMode (buttonPin, INPUT);

randomSeed(analogRead(0));

}

void loop()

{ buttonState = digitalRead(buttonPin);

if (buttonState == HIGH)

{ ran = random(1, 7);

if (ran == 1)

{ digitalWrite (pinLed4, HIGH);

delay (time);

}

if (ran == 2)

{

digitalWrite (pinLeds1, HIGH);

delay (time);

}

if (ran == 3)

{

digitalWrite (pinLeds3, HIGH);

digitalWrite (pinLed4, HIGH);

delay (time);

}

if (ran == 4)

{

digitalWrite (pinLeds1, HIGH);

digitalWrite (pinLeds3, HIGH);

delay (time);

}

if (ran == 5)

{

digitalWrite (pinLeds1, HIGH);

digitalWrite (pinLeds3, HIGH);

digitalWrite (pinLed4, HIGH);

delay (time);

}

if (ran == 6)

{ digitalWrite (pinLeds1, HIGH);

digitalWrite (pinLeds2, HIGH);

digitalWrite (pinLeds3, HIGH);

delay (time);

}

}

digitalWrite (pinLeds1, LOW);

digitalWrite (pinLeds2, LOW);

digitalWrite (pinLeds3, LOW);

digitalWrite (pinLed4, LOW);

}

Step 4: Sequence:

Step 5: Working:

Share

    Recommendations

    • Creative Misuse Contest

      Creative Misuse Contest
    • Water Contest

      Water Contest
    • Fix It! Contest

      Fix It! Contest

    Discussions