Theft Protection

SRJT08201

Jugaadu visited his brother’s office to know about office life. His brother told him that someone from the office takes away his calculator from his desk while he is out for coffee or meetings. By the time he realises it, he can no longer find the calculator. Can you help him to solve the problem?

Bag Items:

  1. Ultra Sonic Sensor
  2. Arduino UNO UNO
  3. Jumper Cables
  4. USB Cable
  5. Glue gun
  6. Foam core sheets
  7. Tape
  8. LED
  9. Cutter
  10. 9V Battery
  11. Buzzer
  12. Battery connector

"


    int trig=8;
int echo=9;
int duration;
int dis;
void setup() {
// put your setup code here, to run once:
pinMode(trig,OUTPUT);
pinMode(echo,INPUT);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
digitalWrite(4,HIGH);
digitalWrite(3,HIGH);
}

void loop() {
digitalWrite(trig,HIGH);
delay(100);
digitalWrite(trig,LOW);
duration=pulseIn(echo,HIGH);
dis=duration/2/29.1;
if(dis<10){
digitalWrite(2,HIGH);
digitalWrite(5,LOW);
}else{
digitalWrite(2,LOW);
digitalWrite(5,HIGH);
}
}