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 obj...
Here we try to find out solutions of every why and how with the help of science.