Template: Infrared Proximity Arduino Guide

From Waveshare Wiki
Jump to: navigation, search

Use with Arduino

The examples provided are based on the Arduino UNO, if you need to use other Arduino boards, please check if the board is compatible with the UNO.

Hardware connection

Hardware connection-Arduino
Connect to Arduino UNO
Infrared Proximity Arduino Description
VCC 5V Power input
GND GND Ground
AOUT A0 Analog data output
DOUT D2 Digital data output

Examples

  • Please download and install Arduino IDE to your PC.
  • Download the demo codes, unzip them, and find the Arduino examples.
  • Open the Infrared_Proximity_Sensor.ino file by the Arduino IDE.
Infrared Proximity Arduino 3.png
  • Build and upload the codes to the UNO board.
  • After uploading, you can open the Serial Monitor of IDE and check the data.

Expected result

  • When a barrier is placed near the sensor, the signal indicator will turn on or else turn off.
  • The serial output will change according to the distance between the module and the barrier.