3.3 Detect the ObstacleΒΆ

This module is commonly installed on the car and robot to judge the existence of the obstacles ahead. Also it is widely used in hand held device, water faucet and so on.

Schematic

../_images/circuit_3.3_obstacle.png

The digital pin 2 is used to read the signal of IR Obstacle Avoidance Module. We get the VCC of IR Sensor Module connected to 5V, GND to GND, OUT to digital pin 2.

Wiring

../_images/detect_the_obstacle_bb.jpg

Code

Note

  • You can open the file 3.3.detect_the_obstacle.ino under the path of 3in1-kit\learning_project\3.3.detect_the_obstacle.

  • Or copy this code into Arduino IDE.

  • Or upload the code through the Arduino Web Editor.

When the IR obstacle avoidance module detects something blocking in front of it, [0] will appear on the serial monitor, otherwise [1] will be displayed.