Diy Electronic
Published © GPL3+

Automated Dino Game using Arduino

Hello friends in this project of today we will make Automated Dino Game using Arduino.

BeginnerFull instructions provided1 hour4,543
Automated Dino Game using Arduino

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
LDR, 5 Mohm
LDR, 5 Mohm
×1
Resistor 10k ohm
Resistor 10k ohm
×1

Story

Read more

Schematics

Automated Dino Game using Arduino

Code

Dino Game Code

C/C++
#include <Servo.h>
#define threshold 250
#define unpress_angle 70 
#define press_angle 36


Servo myservo;  // create servo object to control a servo
bool trig=true;

void setup() {          
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
myservo.write(unpress_angle);   
}

void loop() {

 myservo.write(unpress_angle);              // unpress the button
 delay(1);
 if(analogRead(A0)< threshold)
 {
  
      myservo.write(press_angle);          // press the button
    delay(100 );                       // waits 100ms for the servo to reach the position
                      
 }                     
}

Credits

Diy Electronic

Diy Electronic

3 projects • 4 followers
I love to do Electronic & Electrical Experiment.

Comments