Introduction: If This Then That: the Blackbox: Run, Dodge and Jump
My Name is Remco Liqui lung and this is an If This Then That school project.
The Black box: Run, Dodge and Jump is a box with a playable game contained within it.
The idea behind is that you play a game and when you reach a certain score (100 points) you can grab your reward inside the box. That way you can feel that you've accomplished something and get rewarded for your hard work. Pretty straight forward right?
The game that is being played uses an arduino with basic control's.
The original code which I used comes from Iron_Salsa (https://create.arduino.cc/projecthub/iron_salsastudio/lcd-game-2e69ea), then I added a little twist to it by adding and making some changed to the codes.
In this tutorial I'll show you how I created the box, the list of tools needed to create it, the code and alternative ideas to apply.
Without further ado let's get working mates!
Step 1: List of Tools Used
The tools I used with the arduino:
- Arduino Uno
- LCD Screen (20x4)
- I2C shield for the LCD
- 3 x push button switch
- 4 x Wires male-female
- 7 x breadboard wires
For the box:
- Just you're standard box , any size can be used.
- Couple of screws to screw the lcd, arduino and hinges.
- Glue gun with glue sticks to glue the box together.
- Utility knife or scissors to cut the cardboard.
- Rubber buttons which can be taken from a gaming controller.
- USB plug
Step 2: Step by Step Instructions
Lets start off with of the arduino is put together.
The scheme where the wire should be connected is as followed:
- GND and Reset connects to button (Resets the game)
- GND and Pin 4 connects to button (Chooses the difficulty)
- GND and Pin 2 connects button (Used to play the game)
For this you can use regular breadboard wires to connect to the arduino.
The display is soldered with an I2C Shield which can be purchased separately or connected to the LCD. The connects is purely from the shield to the arduino by using the female to male wires, no need to connect the wires to the breadboard.
- SCL connects to A5
- SDA connects to A4
- GND connects to GND
- VCC connects to 5V
When content with the way it looks like on the breadboard, you can solder it on a breadboardprint.
The way it's soldered, The cables are on the backside of the print while the buttons are in the front. This makes it easier to get to the buttons without the cables in the way.
To make the box fairly simple, you can put one together or just use an box that has the right size to your liking.
My box can be dissected in 2 parts.
The first part where the arduino is hidden is actually an delivery box which was the right size and stability to screw the arduino and the lcd in, with enough space for the print(control's). You can customize in where the arduino is put in very easily as its very flexible and can be applied to any form of object. I made sure to have an port where I can connect my cable to the arduino, that way there would be no need to open the box where the arduino is in. With an USB plug you can connect the arduino to an wall outlet for electricity.
Step 3: The Code, in Depth Explanation
The code is simple at some parts which I'll explain how you can customize a bit to your liking.
In the code file is explained what the codes do and where they referenced as comments.
What difference did I add in the code?
Well, I applied the code to use for a 20x4 screen, adjusted the character and level to use the whole screen.
Added intro page for the school project, and adjusted the difficulty selection. Centered everything that's has text in it. Since my screen has a I2C shield soldered to it, it uses the LiquidCity library especially made for an I2C screen.
Step 4: Video
A video showing the game that's being played
We have a be nice policy.
Please be positive and constructive.