Skip to main content

How to control Google chrome jumping Dinosaur game by using Arduino?



Equipment;
1) An Arduino Uno board
2) A Photo resistive sensor(LDR) [analoge or digital]
3) Jumper wires.
4) A Servo motor 9g.
5) Servo motors attachments.
6) Breadboard.

How it works;

LDR is attached on the screen by which it can read the difference between the black spot(Cactus in the game) and bright spot(no obstacle).
For identifying the black spots precisely we have a little bit set the sensitivity of the LDR sensor and brightness of the screen accordingly.
This LDR data take as a digital input and control the servo motor as a digital output.

Arduino Programming;

#include <Servo.h> 
 Servo myservo;
 // create servo object to control a servo // twelve servo objects can be created on most boards 
 int pos = 0; // variable to store the servo position const 
int ldr=7; 
const int mot=9; 
//--Serial.begin(9600); 
void setup() {
 myservo.attach(9); // attaches the servo on pin 9 to the servo object
 pinMode(ldr,INPUT);
 pinMode(mot,OUTPUT);
 }
 void loop() {
 if (digitalRead(ldr)==1)
{ for (pos = 100; pos <= 140; pos += 20)
 { 
// goes from 0 degrees to 180 degrees // in steps of 1 degree 
 myservo.write(pos); // tell servo to go to position in variable 'pos' 
 delay(15); // waits 15ms for the servo to reach the position 
 }
 for (pos = 140; pos >= 100; pos -= 1)
 {
 // goes from 180 degrees to 0 degrees 
 myservo.write(pos); // tell servo to go to position in variable 'pos' 
 delay(15); // waits 15ms for the servo to reach the position
 } }
 else{ digitalWrite(mot,LOW); } 
//Serial.println(digitalRead(mot));
 }







Demonstration;


Limitation;
   It can not handle birds as it handles only one controller, but it can be done with some extra arrangement.


Thank You





Comments

  1. Bhai muje iss project main kuch perasani aa rahi hai mera whatsapp no 8569928762 hai please contact me as soon as possible and solve my problem. I shall be very thankfull this act of kindness.

    ReplyDelete

Post a Comment

Popular posts from this blog

Flowers photography

IIT kanpur,Aerospace (Aerodynamics) Direct Ph,D interview experiences.

INTERVIEW EXPERIENCE IN AEROSPACE(aerodynamics) AT IIT KANPUR FOR DIRECT PhD  My self *********, I have completed my B.Tech (from Mechanical Engineering) in 2018. I wrote GATE 2018 as well as 2019 and got a decent score. B.tech CGPA was moderate. for PhD programme your GATE score and CGPA not really matter a lot it is just a screening and cutoff purpose, but the thing is you have to really passionate about what you are going to do, you need to really strong in your basic engineering and math, Especially in-depth knowledge of your subject of the domain(not necessary bounded by GATE syllabus)  Domains are broadly classified as AERODYNAMICS     Fluid mechanics, Aerofoil theory, Basic of Turbulences, Heat Transfer Flow separation and    Engineering Maths, FLIGHT MECHANICS AND CONTROL   Mechanics, Fluid mechanics, Aerofoil theory, some control system, Engineering Maths. STRUCTURE AND AEROELASTICITY   Strength of materials, Theory ...

How to make dice game by using LabVIEW?

8. Dice Game (Exercise) In a board game a pair of dice (one is 6 sided and the other is 12 sided) is rolled. You win when there is a matching number, or the sum of the numbers rolled is equal to 18. In this problem we would like to build a VI that will do the following: i) Rolls the pair of dice every 100ms and displays the numbers rolled ii) A digital indicator displays the number of times dice rolled iii) An LED glows when you win iv) A digital indicator displays the number of wins v) Program stops after exactly100 rolls.