41
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
//********************************************//stop
analogWrite
(
M1
,
150
);
//the speed value of motorA is 150
analogWrite
(
E1
,
0
);
analogWrite
(
M2
,
150
);
//the speed value of motorA is 150
analogWrite
(
E2
,
0
);
delay
(
5000
);
//*********************************************//back
analogWrite
(
M1
,
0
);
analogWrite
(
E1
,
0
);
//the speed value of motorA is 0
analogWrite
(
M2
,
0
);
analogWrite
(
E2
,
0
);
//the speed value of motorB is 0
delay
(
1000
);
//******* ***************************************//stop
analogWrite
(
M1
,
0
);
analogWrite
(
E1
,
180
);
//the speed value of motorA is 180
analogWrite
(
M2
,
180
);
//the speed value of motorB is 180
analogWrite
(
E2
,
0
);
delay
(
3000
);
//*******************************************//left
analogWrite
(
M1
,
0
);
analogWrite
(
E1
,
0
);
//the speed value of motorA is 0
analogWrite
(
M2
,
0
);
analogWrite
(
E2
,
0
);
//the speed value of motorB is 0
delay
(
1000
);
//***** **************************************//stop
analogWrite
(
M1
,
200
);
//the speed value of motorA is 200
analogWrite
(
E1
,
0
);
analogWrite
(
M2
,
0
);
analogWrite
(
E2
,
200
);
//the speed value of motorB is 200
delay
(
3000
);
//*** ***************************************//right
}
Summary of Contents for Hummer-Bot-1.0
Page 1: ...Hummer Bot 1 0 Instruction Manual V 2 0 ...
Page 18: ...15 Step4 You need to install motors Figure 3 1 5 Schematic diagram of motor installation ...
Page 50: ...47 Figure 3 2 15 Diagram of Data without Obstacles ...
Page 83: ...80 Test code Path hummer bot Lesson ModuleDemo IrkeyPressed IrkeyPressed ino ...