Introduction: Speed Math Game With Arduino

About: My name is José Luis Bejarano Vásquez.Tecnólogo en electrónica, estudiante de ing electrónica, desarrollador de software. Aficionado a la robótica. Blogger.

Hi, how fast can you do math? Speed Math Game is a fun way to learn and practice your math skills.

It has 3 levels (Easy, Medium and Hard).

The easy level shows numbers between 1 and 10.

In the Medium level the first operand of the operation is a number between 50 and 99 and the second operand is a number between 1 and 10.

The Hard level shows numbers between 50 and 99.

When the game starts, it displays the level mode, press 1, 2 or 3 to select the level.

After, operations ("+", "-", "*", "/") will be randomly generated, and the user will type the result of the operation, while the time elapsed is shown (minutes, seconds, and hundreths of seconds).

Only type the result, and if it is right, automatically the next operation is shown (NO Enter key is needed), if you make a mistake in the result, a sad face is shown and you can correct.

Step 1: Lists of Materials.

  • Arduino One or another model.
  • Hex keyboard.
  • LCD 16x2
  • Jumpers.

Step 2: Wiring

Hookup all the components according to the circuit diagram shown above.

Step 3: The Code

randomSeed(analogRead(Read(0));

The code uses the random function for generating random numbers, and also generates a random number between 1 and 4 for the operation.

If it is 1, the operation is ADD (+)

If it is 2, the operation is SUBS (-)

If it is 3, the operation is MUL (*)

If it is 4, the operation is DIV (/).

Also shows a timer in the right top of the display.

void timer()
{

if(modePlay==true)

{

time = millis()-inicio;

m=(time/1000)/60; //Minutes

mu=m%10;

md=(m-mu)/10;

s=(time/1000)%60; //Seconds

su=s%10;

sd=(s-su)/10;

c=(time/100)%60;

cu=c%10;

cd=(c-cu)/10;

lcd.setCursor(8,0);

lcd.print(md);

lcd.print(mu);

lcd.print(":");

lcd.print(sd);

lcd.print(su);

lcd.print(":");

lcd.print(cd);

lcd.print(cu);

}

}

Download the full code here

I hope you like my project, and if so, please vote for it in the maker olympics contest.

Suggestions? Questions? Commets? Please let me know it.

Maker Olympics Contest 2016

Participated in the
Maker Olympics Contest 2016