Introduction: Arduino Eletronic Double Dice

Picture of Arduino Eletronic Double Dice
This dice is based on the Arduino.
It is easy construction and use of few components, which components are:
1 Atmega 8
1 Battery 3v
14 LEDs
a 10k resistor
a AVR icsp connector
a button
and a switch

The ATMEGA8 is programmed via an external programmer, the ATMEGA8 is configured to use the internal oscillator to minimize the maximum The components.
http://youtu.be/vIW5zxfiJAk

Comments

amandaghassaei (author)2012-08-09

cool project. can you post a schematic and your code?

gosvitor (author)amandaghassaei2012-08-09

I'll design the layout and then publish ... But there is nothing complicated ... It was done without writing scheme because he did not know which pins could try to use way more into account the layout of the board compomentes...

The code...

int buttonState = 0;
int brilho = 0;
int aumento = 0;
long dadoA;
long dadoB;
void setup() {
pinMode(13, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
pinMode(11, OUTPUT);
pinMode(7, OUTPUT);
pinMode(4, OUTPUT);
pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
pinMode(12, INPUT);
}

void loop() {
buttonState = digitalRead(12);
if (buttonState == HIGH) {
dadoA = random(1,7);
dadoB = random(1,7);
}
dado_a:
if (dadoA == 1) {goto a1;}
if (dadoA == 2) {goto a2;}
if (dadoA == 3) {goto a3;}
if (dadoA == 4) {goto a4;}
if (dadoA == 5) {goto a5;}
if (dadoA == 6) {goto a6;}
a1:
digitalWrite(13, HIGH);
digitalWrite(10, LOW);
digitalWrite(9, LOW);
digitalWrite(11, LOW);
goto dado_B;
a2:
digitalWrite(13, LOW);
digitalWrite(10, LOW);
digitalWrite(9, HIGH);
digitalWrite(11, LOW);
goto dado_B;
a3:
digitalWrite(13, HIGH);
digitalWrite(10, LOW);
digitalWrite(9, HIGH);
digitalWrite(11, LOW);
goto dado_B;
a4:
digitalWrite(13, LOW);
digitalWrite(10, HIGH);
digitalWrite(9, LOW);
digitalWrite(11, LOW);
goto dado_B;
a5:
digitalWrite(13, HIGH);
digitalWrite(10, HIGH);
digitalWrite(9, HIGH);
digitalWrite(11, LOW);
goto dado_B;
a6:
digitalWrite(13, LOW);
digitalWrite(10, HIGH);
digitalWrite(9, HIGH);
digitalWrite(11, HIGH);
dado_B:
if (dadoB == 1) {goto b1;}
if (dadoB == 2) {goto b2;}
if (dadoB == 3) {goto b3;}
if (dadoB == 4) {goto b4;}
if (dadoB == 5) {goto b5;}
if (dadoB == 6) {goto b6;}
b1:
digitalWrite(7, HIGH);
digitalWrite(4, LOW);
digitalWrite(3, LOW);
digitalWrite(2, LOW);
goto fim;
b2:
digitalWrite(7, LOW);
digitalWrite(4, LOW);
digitalWrite(3, HIGH);
digitalWrite(2, LOW);
goto fim;
b3:
digitalWrite(7, HIGH);
digitalWrite(4, LOW);
digitalWrite(3, HIGH);
digitalWrite(2, LOW);
goto fim;
b4:
digitalWrite(7, LOW);
digitalWrite(4, HIGH);
digitalWrite(3, HIGH);
digitalWrite(2, LOW);
goto fim;
b5:
digitalWrite(7, HIGH);
digitalWrite(4, HIGH);
digitalWrite(3, HIGH);
digitalWrite(2, LOW);
goto fim;
b6:
digitalWrite(7, LOW);
digitalWrite(4, HIGH);
digitalWrite(3, HIGH);
digitalWrite(2, HIGH);
fim:
;
}

About This Instructable

1,640views

7favorites

License:

More by gosvitor:Add a custom programmer on Arduino IDEArduino eletronic double dice
Add instructable to: