Magic 8 – HERO 128×64 OLED Game

A game based off of the Magic 8 Ball manufactured by Mattel. Uses randoms, OLED screen, and is super simple.

COMPONENTS AND SUPPLIES

OLED Display

1

InventrKits HERO

The HERO is a derivative of “Arduino UNO R3 Reference design” we just changed up a few things to make it our own. If you’re curious about what goes into our HERO board we published the open-source hardware files on our GitHub.

1

Male to Female Wire

3

ABOUT THIS PROJECT

CODE

				
					
				
			

COMMENTS

Comments (3)

  • Mike Sparks Reply

    How can I break a text string so I cand display 2 lines

    May 17, 2021 at 9:42 pm
    • Belrey Dahonog Reply

      Hi Mike, what text string would you like to break?

      May 19, 2021 at 11:13 pm
  • Xander Tornabell Reply

    I found an errors that said exit status 1, what does that mean?

    July 28, 2021 at 5:32 pm

Leave a Reply

Your email address will not be published. Required fields are marked *

#include “U8glib.h” U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI long randomEightBall = 0; void draw(void) { // graphic commands to redraw the complete screen should be placed here u8g.setFont(u8g_font_unifont); switch (randomEightBall) { case 0: u8g.drawStr( 0, 22, “Yes”); break; case 1: u8g.drawStr( 0, 22, “No”); break; case 2: u8g.drawStr( 0, 22, “I’m not sure”); break; case 3: u8g.drawStr( 0, 22, “Maybe”); break; case 4: u8g.drawStr( 0, 22, “likely”); break; case 5: u8g.drawStr( 0, 22, “unlikely”); break; case 6: u8g.drawStr( 0, 22, “try again”); break; case 7: u8g.drawStr( 0, 22, “Buy More Inventr”); break; } delay(50); } void setup(void) { // assign default color value u8g.setColorIndex(1); // pixel on randomSeed(random(analogRead(0))); delay(30); randomEightBall = random(8); } void loop(void) { // picture loop u8g.firstPage(); do { draw(); } while( u8g.nextPage() ); }
PROJECT AUTHOR
Leave a comment
TABLE OF CONTENTS
Leave a comment
Share on whatsapp
Share on facebook
Share on twitter
Share on linkedin
Share on reddit
Share on pinterest
Share on email

SIMILAR PROJECTS YOU MIGHT LIKE

I cascaded four SN74HC595 shift registers to control 32 LEDs on 4 registers using 3 wires. I am adding a I2C 20×4 LCD screen to display the register and led values. I might add a standard 16×2 LCD screen to show up it is done.
A simple light meter. It’s not calibrated to any meaningful scale, but the digital readout shows a higher number the brighter is the light falling on the photoresistor.