Add the sensors to the Robot object and develop the line-following behavior code.
Add the sensors to the Robot object and develop the line-following behavior code - Proteus Simulation
Proteus Circuit Design:
Components Required:
1) Arduino Uno
2) IR sensors (x2)
3) L298 Motor Controller
4) DC motors (x2)
5) Logic Toggle (x2)
6) Ground
7) Power, DC
Link for Libraries:
https://drive.google.com/drive/folders/18G4d2w5Sot_XCv7rKVMpC90EIM1FT8_f
Code for Circuit:
void setup() {
pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
}
void loop() {
int v = digitalRead(2);
int s = digitalRead(3);
if(v == 1 and s == 1){
digitalWrite(13, 1);
digitalWrite(12, 0);
digitalWrite(11, 1);
digitalWrite(10, 0);
}
if(v == 1 and s == 0){
digitalWrite(13, 0);
digitalWrite(12, 1);
digitalWrite(11, 1);
digitalWrite(10, 0);
}
if(v == 0 and s == 1){
digitalWrite(13, 1);
digitalWrite(12, 0);
digitalWrite(11, 0);
digitalWrite(10, 1);
}
if(v == 0 and s == 0){
digitalWrite(13, 0);
digitalWrite(12, 1);
digitalWrite(11, 0);
digitalWrite(10, 1);
}
}
can you please give explaination of code
ReplyDeleteAttend the lecture
ReplyDelete