top of page

Google Chrome Dinosaur Game Hack

Writer's picture: Karan BarmanKaran Barman

Updated: Apr 23, 2020

The most trending on internet the dogging/jumping dinosaur, I thought to hack one, just for fun.


Working:- The Hack is simply works on LDR(Light Dependent Resistor).

it's a passive sensor which is used to sense the intensity of light measured in (lux)i.e.

To process this sensor value we need a micro-controller which is used to read the LDR sensor value as a Analog input in terms of voltage in range of 0 to 5V & that is converted to the range of 0 to 1023 with the help of micro-controller.

All we have to do is write a code in such a way that the change in value from range 0-1023, we have to note the value of LDR sensor wherever it deflects while the sensor is placed on screen & the trees passes by.

which is then processed by micro-controller as an Analog input which will then be converted into a Digital signal to actuate the servo motor.

We have to place the LDR sensor so that it read the value when to jump & servo motor placed with a double sided tape so that it presses the space bar.


for circuit diagram refer video & image


Check Image for reference.



Here, I have attached the code which is a "basic one but, when the speed increases it has to be used with interrupts to calculate the difference of time when the tree passes by".

Code:-


#include <Servo.h>  // Include Servo library
Servo Jump;         // give a name to define servo (jump)

int Pin= A0;  //Define the Analog Pin - A0
int val= 0; //Define the value to read the sensor input initially as 0

void setup() {
  Serial.begin(9600);
  pinMode(Pin, INPUT);  //Set the Analog Pin as INPUT
  Jump.attach(2);     // Attach the Servo to Pin 2 of Arduino
}

void loop() {
 val = analogRead(Pin);// Now read the sensor val through analog pin A0
 Serial.println(val);  // Print the value of sensor in Serial monitor
if (val>=450) // Now set the value of your LDR changes in range 0- 1023
{
  Jump.write(val); //now write the value to servo with a delay of 1 sec
  delay(1);
}  else
  { 
    Jump.write(0); //To stop the motion after 1 sec movement of servo
    delay(1);
  }
}


Also, here i have simulated the same with the Proteus simulation.

Feel free to ask, if any doubts write in comments below.

Thank you..!!!


 
 
 

Recent Posts

See All

Worlds Best Seller Books & Novels

Hello..!!! Reader's. I would like to share you, the worlds best seller Books & Novels that are inspirational, influencing & will change...

Comments


bottom of page