Introduction: Simon Says Game Made Using Evive (Arduino Powered Embedded Product)

How fun it will be first to make a DIY game and then play it woth your friends! So here we will make a game. Its called Simon Says. We have made this game using evive. The codes are developed in very simple fashion in Arduino IDE. The objective of the game is simple: there are five LEDs/bulbs and five corresponding switches. The bulbs light up in a random order generated everytime. You then have to press the buttons in the exact same order. If the sequence is correct, a 'correct' sequence of lights starts and you will progress to the next level. The current level number will be displayed on the TFT screen of evive. Otherwise, an 'incorrect' sequence lights up. A "Game Over" is displayed on the screen.

Step 1: Components Used

Picture of Components Used

Components required:

  • evive
  • (Optional) TFT screen (evive has inbuit TFT screen :P )
  • Breadboard
  • male- male jumper cables
  • Breadboard wires
  • 5 LEDs
  • 5 Push (Tactile) Buttons
  • 5 Resistors 220 ohms each
  • 5 Resistors 1 kilo-ohm each

Step 2: Making the Connections

Picture of Making the Connections

First, we make the first bulb- pushbutton set.

  • Place a pushbutton on the breadboard.
  • Now, above the right side of the button, insert the positive terminal of the led (the longer one) and the negative terminal into the hole right to it. Now, ground the negative terminal through a 220 ohm resistor.
  • Make the left side of the pushbutton positive.
  • Now, connect the other side of the pushbutton to a digital pin of the evive (pin2).
  • Also, ground this through a 1 kilo ohm resistor (pulling down the switch)

Now we just have to repeat the above process 4 more times. Connect these to pins 3,4,5 and 6. For more info you can see the circuit diagram.

Notice that at this point, any pushbutton you press will light up the corresponding bulb. Take care not to inter- connect two different bulb- pushbutton sets.

evive has inbuit 1.8" TFT screen with SPI interface. You can check the internal wiring diagram here.

Step 3: Coding the Game

Picture of Coding the Game

We are using same pins i.e. 2, 3, 4, 5 and 6 as both input and output.

Initially, we declare all the pins connected to bulbs as OUTPUT. This will enable them to glow (for the showing of the sequence). After the showing of the sequence, the pins are declared as INPUT (for getting input from the pushbutton response)

The basic motive is to determine which button is being pressed. Since only one pushbutton will be pressed at a given time, it is fine to check if any of the input pins is HIGH in an 'or' statement. Then we can check which of the buttons was pressed individually.

The target sequence (shown initially) is generated by using the pseudo-random number generator of the Arduino IDE. After the input response is registered, it will be compared with the target sequence.

You can view and download the code at our git repository.

Step 4: Displaying Text on the Tft

Picture of Displaying Text on the Tft

evive uses ST7735 SPI 1.8" colored TFT screen and the library for this screen is available on adafruit. This is a hardware level library. You can download the library from github https://github.com/adafruit/Adafruit-ST7735-Library

Some examples are also included in the github repository above.

To display text, we basically need these three functions-

  • setTextColor(textcolor, textbackgroundcolor)
  • setCursor(x-coordinate, y-coordinate)
  • setTextSize(size)

The screen is cleared by setBackgroundColor(backgroundcolor).

Step 5: Setting Different Levels

Picture of Setting Different Levels

We have set some levels also, actually it has 10 levels. As you approach the next level the time delay for which the LED is on is reduced. In level 1 it is about 500 milliseconds, after level it get reduced by 50 milliseconds.

Step 6: Finally, Play the Game Made by YOU With Evive Using Arduino IDE

Picture of Finally, Play the Game Made by YOU With Evive Using Arduino IDE

Now it is ready to play. Show it to your friends and enjoy playing with them. And lets watch who reaches to maximum level.

You can check out more about evive here. Its a ONE-STOP solution for all your DIY projects.

Visit our YouTube channel for more projects.

Comments

KISELIN (author)2016-07-02

In the dawn of a human realyizing the "micro-electronics, some times before You was born", there was just the same "idea" of what a human could do with this "Amaizing" tech. Hang on. Yu'll be inlighted.So did allso Edison .. Marconi.. etc. company

About This Instructable

211views

5favorites

License:

Bio: evive is an open-source embedded platform for all age groups and profession to help them learn, build, debug their robotics, embedded and other projects. With ... More »
More by evivetoolkit:DIY Magnetic Table Hockey With Cardboard, RGB Lights and SensorsTele Operated Bionic ArmCapacitive Touch With Evive (Arduino Based Controller)
Add instructable to: