How to Win Chrome Dinosaur Game With Arduino

by Arduino Circuit in Circuits > Arduino

566 Views, 1 Favorites, 0 Comments

How to Win Chrome Dinosaur Game With Arduino

How-to-win-hack-Chrome-Dinosaur-T-Rex-game-with-Arduino.png

Introduction

In this Project, we are going to make a How to Win Chrome Dinosaur game with Arduino. The dinosaur game, also known as the T-Rex game, is a popular and addictive game that can be played offline in the Google Chrome browser when there is no internet connectivity. In this game, the player controls a dinosaur and avoids obstacles by jumping over them. However, playing this game for a long can be tedious and tiring. Therefore, we designed an automated Dino game using Arduino that can play the game on behalf of the user.

What You Will Need

For this tutorial you will need the Following Components:

  1. Arduino UNO
  2. Servo Motor
  3. LDR (Light Dependent Resistor)
  4. Resistors 10K
  5. Jumper Wires
  6. Breadboard

Circuit Diagram

How-To-make-Automated-Chrome-Dino-Game-using-Arduino-Circuit.png

Circuit Construction

The circuit for the automated Dino game using Arduino is straightforward and easy to build. First, we will connect the LDR to the analog input of the Arduino. Then, we will connect a 10K resistor in series with the LDR to create a voltage divider circuit. Next, we will connect the servo motor to the digital output of the Arduino using jumper wires.

Setup LDR and Servo

Automated-Chrome-Dino-Game-using-Arduino.png

This LDR-based detection system allows for easy triggering of a servo motor, which can be used to press the space button on a connected laptop. By positioning the LDR on the laptop screen rather than on the road surface, this setup provides reliable and efficient detection of changes in light levels. Once the LDR senses darkness, it sends a signal to the Arduino Analog Pin (A0), which then signals digital pin 9 to activate the servo motor.

The simplicity of this circuit makes it an excellent choice for beginners and experts alike. Share this project with your friends and family who use PC laptops or desktops to help them enhance their computing experience.


Code Upload

//For more Projects: www.arduinocircuit.com
#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
 }
}