Pages

Tuesday, May 28, 2013

Arduino Dice Box: Round One

Description:
I have not had much time to play recently. I was meaning to post this for some time now. I present the first iteration of my Arduino Dice Box. This project is a 5 way nav switch and a LCD display with I2C backpack that lets you roll virtual dice of various sizes and quantities. The program uses the random number function tied to an open pin to generate all the rolls. I have still not decided on a housing for this project and I am thinking of making another version that can use an 8x8 LED grid instead of a LCD display. So, lets get to it.

The Parts:
1 x Arduino Uno
1 x 5 Position switch (http://www.parallax.com/Store/Sensors/PressureFlexRPM/tabid/177/CategoryID/52/List/0/SortField/0/Level/a/ProductID/615/Default.aspx)
1 x LCD 16x2 display (http://www.adafruit.com/products/181)
1 x i2c / SPI character LCD backpack (http://www.adafruit.com/products/292)

The Buildout:
The switch is wired up to pins 2-6. The switch is wired with built in pull ups so you will want to wire that up with Vcc and GND. The other pins are:
  • Left is pin 2
  • Down is pin 3
  • Press is pin 4
  • Right is pin 6
  • Up is pin 5

The display is wired using i2c so aside from Vcc and GND you have 2 pins:
  • DAT (SDA) is A4
  • CLK (SCL) is A5 
The Code:

Code also available on GitHub here

The Output:
The output is the dice on the top and the roll on the bottom. if you change the die size or quantity it will display the last roll and die choice on the bottom. You can see from the attached pictures what the output looks like.



No comments:

Post a Comment