Introduction: Simple Graphical Game With Arduino and OneSheeld

I don't know much Java or Android , so I tried to make a simple game with the Arduino C I know, and I found that it's possible using 1Sheeld , moreover it is not just a software game, i added push buttons to make it easier and more fun to control.

This game is a rectangle figure that jumps when one of the buttons is pressed, and gets down (doesn't complete the jump ) when the other button is pressed . I added a rounded obstacle, which when the figure hits, the graphical screen will display "Try again " and the figure will go back to the start point.

If the figure jumps in the right time and doesn't hit the obstacle, then moves safely to the end of the screen, it will display " You Win " .

Obviously, endless possibilities and features can be added, you can make the figure look more like a Mario character ( I called my rectangle Mario, because i intended to make it look like him ) , you can add more obstacles, and add counters for the life losses (the trials) and so on .. You can add background decorations like a cloud in the sky, or a bird .. All of this is possible if you understand the concepts of this simple project ..

Step 1: Components Needed.

-First step is get started with the One Shield board, this board let's you use your smartphone's sensors, camera, speakers, mic more than 40 different shields, and control them using very simple line of codes , so if you have never used it before, try the simple tutorials here.

-We then need two push buttons .

-10K ohm resistor for each button.

-Male-male jumper wires.

-Download the 1Shield Android App here.

Step 2: Buttons Connections

I used Push Buttons with only two legs, and the connection is the same for each button.

One of the legs is connected to the arduino 5 Volt pin.

The other leg is connected to one of the arduino's digital pins , in series I connected one of the 10K resistor's terminal to that point and the other terminal is connected to the arduino ground.

I used pin 12 for the Jump-Up button and pin 13 for the Down button.

If you're having tough time dealing with push buttons and the HIGH-LOW issues you can find more details about the connections and code here .

Step 3: Coding

- Make sure while uploading the code, that the 1Sheeld is on the upload mode , and when you connect it to your android phone make sure it's on operating mode ( As shown in the tutorials, the symbol on the 1Sheeld board which shows connected wires is the operating mode, and the disconnected sires is the upload mode).

- Open the application and choose GLCD shield .

PS: - If you want to understand the GLCD shield more along with it's 1Sheeld functions you can check this documentation.

- The photo in the intro shows a game I lost, and the video below shows a winning game, the video's speed is doubled because the GLCD is quite slow and the blinks are due to the delay functions in my code.