IT’S SERVING TO YOU

TLROB006

Jugaadu is organizing a birthday party at home. He is thinking to place the chocolate in a box that moves on the table without falling. Can you help him to prepare the smart box? [Keep in mind children can pick the box and put it back]
Robo Car chassis Kit
  1. Attach 2 motors and caster wheel to the chassis.
  2. Create a system of motor driver IC and arduino UNO.
  3. Attach IR sensor in front of the cart and connect it with Arduino.
  4. Code on arduino IDE. (for connection and code take help of let's tinker app)

    

int lm1=8; 

int lm2=9; 

int rm1=10;

int rm2=11;

int led=13;

int sr=12;

int SrV=0;

void setup()

{

pinMode(lm1,OUTPUT);

pinMode(lm2,OUTPUT);

pinMode(rm1,OUTPUT);

pinMode(rm2,OUTPUT);

pinMode(led,OUTPUT);

pinMode(sr,INPUT);

 sTOP();

}

void loop()

{

SrV=digitalRead(sr);

if(SrV==LOW)

{

ForWard();

}

 if(SrV==HIGH)

{

BackWard();

delay(400);

Right();

delay(550);

ForWard();

delay(200);

}

}

void ForWard()

{

digitalWrite(lm1,HIGH);

digitalWrite(lm2,LOW);

digitalWrite(rm1,HIGH);

digitalWrite(rm2,LOW);

void BackWard()

{

digitalWrite(lm1,LOW);

digitalWrite(lm2,HIGH);

digitalWrite(rm1,LOW);

digitalWrite(rm2,HIGH);

}

void Left()

{

digitalWrite(lm1,LOW);

digitalWrite(lm2,HIGH);

digitalWrite(rm1,HIGH);

digitalWrite(rm2,LOW);

void Right()

{

digitalWrite(lm1,HIGH);

digitalWrite(lm2,LOW);

digitalWrite(rm1,LOW);

digitalWrite(rm2,HIGH);

}

void sTOP()

{

digitalWrite(lm1,LOW);

digitalWrite(lm2,LOW);

digitalWrite(rm1,LOW);

digitalWrite(rm2,LOW);

}