Ingeimaks Ingeimaks
Published © TAPR-OHL

How to make a game with Arduino DIY

This buzzing thread game allows the user to challenge their steady hand. The goal is to bring the game handle from one side of the maze to t

IntermediateFull instructions provided815
How to make a game with Arduino DIY

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Alphanumeric LCD, 16 x 2
Alphanumeric LCD, 16 x 2
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Button
×1

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Schematics

electrical scheme

Code

Code

Arduino
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

int Stato_Bottone = 0; 
int Pin_Bottone = 10;
int errori = 0;
int Pin_Asta = 9;
int Stato_Asta = 0;


void setup()
{ 
   
  pinMode(Pin_Asta, INPUT);
  pinMode(Pin_Bottone, INPUT);
  
  Serial.begin(9600);
  
  lcd.begin(16, 2); 
  lcd.setCursor(0, 0); 
  lcd.print("START GAME !");  
  delay(3000); 
  lcd.clear(); 

  do{
  
  lcd.setCursor(0, 0);
  lcd.print("PREMI IL BOTTONE");        
  lcd.setCursor(0, 1);
  lcd.print("PER INIZIARE");
  Stato_Bottone = digitalRead(Pin_Bottone);
  Serial.println(Stato_Bottone);
  
  }while(Stato_Bottone == 0);
                          
  Stato_Bottone = 0;
  
  delay(1500);
}
 
void loop()
{ 

  
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("START !");
  lcd.setCursor(0, 1);
  lcd.print("ERRORI = ");
  lcd.setCursor(9, 1);
  lcd.print(errori);
  
  do{
  
  Stato_Asta = digitalRead(Pin_Asta);
  
  if(Stato_Asta == 1){  
  errori=errori+1;
  lcd.setCursor(9, 1);
  lcd.print(errori);
  delay(1000);
  Stato_Asta=0;
  }
  
  Stato_Bottone = digitalRead(Pin_Bottone);

  if(Stato_Bottone == 1){
  lcd.clear();  
  lcd.setCursor(0, 0);
  lcd.print("HAI VINTO !");
  errori = 0;
  delay(3000);
  loop();
  }
  
  }while(errori < 3);

  lcd.clear();
  
     
  lcd.setCursor(0, 0);
  lcd.print("GAME OVER !");  
  Stato_Bottone = 0;
  errori = 0;
  
 delay(2000);
 
}

Credits

Ingeimaks Ingeimaks

Ingeimaks Ingeimaks

14 projects • 45 followers
Giovanni Mannara is a Maker. Thanks to Massimo Banzi I have traversed this path of Digital Creator ... I LOVE ARDUINO !!!

Comments