Introduction: VISUINO Rolling Dice Using 0.96 Inch 4 Pin OLED Module
In this tutorial we will use OLED Lcd and Visuino to make a Rolling Dice when we push a button on our breadboard.
Watch a demonstration video.
Step 1: What You Will Need
For this tutorial you will need:
- Arduino uno
- Breadboard (or breadboard shield)
- OLED Lcd
- Jumper wires
- Red LED (or any other color)
- Pull-up resistor (50k ohm)
- Visuino program: Download Visuino
Step 2: The Circuit
The connections are pretty easy, see the above image with the breadboard circuit schematic.
Connect breadboard positive pin to Arduino 5V pin and connect the breadboard negative pin to Arduino GND pin.
- Connect positive pin of LED to Arduino pin 13 and the other to GND pin on breadboard.
- Connect resistor pin to breadboard positive pin and other resistor pin to button pin. Now connect other button pin to Arduino A0 pin.
- Connect OLED lcd positive pin to breadboard positive pin and OLED lcd negative (gnd) pin to breadboard negative pin.
- Connect OLED lcd SCL pin to Arduino SCL pin
Connect OLED lcd SDA pin to Arduino SDA pin
Step 3: Start Visuino, and Select the Arduino UNO Board Type
To start programming the Arduino, you will need to have the Arduino IDE installed from here: http://www.arduino.cc/.
Please be aware that there are some critical bugs in Arduino IDE 1.6.6. Make sure that you install 1.6.7 or higher, otherwise this Instructable will not work! If you have not done follow the steps in this Instructable to setup the Arduino IDE to program ESP 8266!
The Visuino: https://www.visuino.eu also needs to be installed.
Start Visuino as shown in the first pictureClick on the "Tools" button on the Arduino component (Picture 1) in VisuinoWhen the dialog appears, select "Arduino Uno" as shown on Picture 2
Step 4: In Visuino: Add and Connect Pulse Generator, Logic Gate and Random Generator Component
- Add Pulse Generator, set frequency to 100 (it will auto change to 1E2) see pic2
- Add Logic gate AND
- Add Random Integer Generator, set Max:6 and Min:1 and Seed:9999999
Step 5: In Visuino: Add OLED Lcd Component
- Add OLED Lcd component (picture 1)
- Double click on OLED Lcd component, the dialog window will open
- On the right select "text field" and drag it onto the left side (picture 2)
- in window "properties" set size: 9, width:6,x:30 (picture 3)
- In the the dialog window on the right select "Fill screen" and drag it onto the left side (picture 2)
in window "properties" set color: tmcBlack (picture 4)
Step 6: In Visuino: Connecting Components
- Connect Pulse Generator pin Out to logic gate component pin 
- Connect Logic Gate pin  to Arduino Analog pin [A0]
- Connect Logic Gate pin Out to Arduino pin Digital 
- Connect Logic Gate pin Out to Random Integer Generator pin Clock
- Random Integer Generator pin Out to Display OLED - Elements Text Field1 Pin [In]
- Connect Display OLED Pin [A In] to Arduino Pin Serial [Out]
- Connect Display OLED Pin [Out] to Arduino Pin I2C [In]
- Connect Display OLED - Elements Fill Screen1 Pin [Clock] to Arduino Pin [A0]
- Connect Arduino Serial Pin [In] to Arduino Pin [A0]
Step 7: Play
If you power the Arduino Uno module, the Oled Lcd will start showing random numbers once you press a button.
Congratulations! You have completed your Rolling Dice project with Visuino.
Also attached is the Visuino project, that I created for this Instructable. You can download and open it in Visuino: https://www.visuino.eu