arduino - I2C method

Experimental preparation

  1. Arduino mainboard

  2. 8-channel line patrol module

  3. Several Dupont cables

Adruino board needs to download the I2C communication source code provided in the document

Purpose

The content of this experiment is mainly to use the Arduino master to receive the data of the 8-channel line patrol module through I2C.

Experimental wiring

Adruino connected to the serial port assistant, directly use the program download port to connect

adruino8-channel line patrol module
SDASDA
SCLSCL
5V5V
GNDGND

As shown in the figure: image-2024110100001

Experimental steps and phenomena

  1. After connecting the wires, open the serial port assistant and you can see the numerical data of the infrared module. Set the baud rate to 115200. As shown below:

image-20241112143903133

Experimental source code

The source code obtains the data of the infrared probe by reading the register address 0x30 of the infrared module and prints it out through the serial port.