Infrared Obstacle Avoidance - Keywish Hummer-Bot-1.0 Instruction Manual

Table of Contents

Advertisement

//********************************************//stop
analogWrite(M1,
analogWrite(E1, 0);
analogWrite(M2,
analogWrite(E2, 0);
delay(5000);//*********************************************//back
analogWrite(M1, 0);
analogWrite(E1, 0);
analogWrite(M2, 0);
analogWrite(E2, 0);
delay(1000);
//******* ***************************************//stop
analogWrite(M1, 0);
analogWrite(E1, 180);
analogWrite(M2,
analogWrite(E2, 0);
delay(3000);
//*******************************************//left
analogWrite(M1, 0);
analogWrite(E1, 0);
analogWrite(M2, 0);
analogWrite(E2, 0);
delay(1000);
//***** **************************************//stop
analogWrite
analogWrite(E1, 0);
analogWrite
analogWrite(E2, 200);
delay(3000);//*** ***************************************//right
}

3.2.2 Infrared Obstacle Avoidance

3.2.2.1 Introduction of Infrared Obstacle Avoidance Sensor
Infrared obstacle avoidance module is a pair of infrared transmitting and receiving tubes, the former
launches a certain frequency infrared, the receiving tube will receive the reflected infrared when the infrared
detects the obstacles. After the signal is processed by the comparator circuit, the green LED lights, and the
signal output port outputs digital signal at the same time (a low level signal). The detection distance can be
adjusted through the potentiometer knob, the effective distance range is 2-30cm, the working voltage is
3.3V-5V. The sensor uses infrared, so the anti-interference ability is very strong, the measurement accuracy
is very high when the distance is moderate. In addition, the module can be assembled easily and used
150);//the speed value of motorA is 150
150);//the speed value of motorA is 150
//the speed value of motorA is 0
//the speed value of motorB is 0
//the speed value of motorA is 180
180);//the speed value of motorB is 180
//the speed value of motorA is 0
//the speed value of motorB is 0
(M1, 200);
//the speed value of motorA is 200
(M2, 0);
//the speed value of motorB is 200
41

Advertisement

Table of Contents
loading

Table of Contents