hashan_sudeera
Published

Automated Dino Game using Arduino

This is My 3rd project with Arduino.

BeginnerProtip323
Automated Dino Game using Arduino

Things used in this project

Hardware components

Arduino UNO
Arduino 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

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Automatic dino game circuit

Code

dino_code

C/C++
#include <Servo.h>

Servo con_servo;

int ldr=A0;


void setup() {                                                    
  Serial.begin(9600);
  con_servo.attach(9);
  pinMode(ldr,INPUT);

}

void loop() {

  int x=analogRead(ldr);

  if(x<100){
    con_servo.write(4);
  }

  if(x>100){
    con_servo.write(20);
  }

  Serial.println(x);
  delay(0.4);
  

}                                                                                                                                                                                                        

Credits

hashan_sudeera

hashan_sudeera

5 projects • 3 followers

Comments