I thought it would be a bit of fun to make a Magic 8 Ball using an Arduino and an i2c LCD screen, so here are some Instructions on how to do this.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Stuff You Will Need
- Arduino of some type (I'm using an esp8266 but there is no need to use this type)
- LCD Display
- i2c Module for the LCD Display
- Push button
- 10k Ohm Resistor
- Wires to connect it all up
Step 2: How to Connect It Up
Details on how to connect this up are in my video on youtube.
More details of how to connect the i2c LCD screen to an Arduino can be found in my other Instructable called 'Nodemcu devkit (esp8266) display temperature on an i2c lcd display'.
Step 3: Sketch
I've attacked my sketch that I used to show the Magic 8 ball answers on the LCD display.
If you use different pins on your Arduino you will need to change in the sketch where they are set, which is the following line :
Also if you're not using 16x2 LCD display you will also need to change the following line:
LiquidCrystal_I2C lcd(0x27, 20, 4);
Lastly the pin that you connect your push button will need to be changed if you connect your button to another pin, on the following line :
const int buttonPin = 4; // the number of the pushbutton pin
Step 4: It Works!!!!
Each time you press the push button, you'll get another random answer from the list in the array.
Happy times!! I hope the magic 8 ball gives you the answer you was hoping for. :)