Welcome to 8-Channel Tracking Module repository
IO method
arduino-IO method
arduino-IO methodExperimental preparationExperimental PurposeExperimental wiringExperimental steps and phenomenaExperimental source code
Experimental preparation
Arduino mainboard
8-channel line patrol module
Several Dupont cables
Adruino board needs to download the IO communication source code provided in the document
Experimental Purpose
The content of this experiment is mainly to use the Arduino master to receive data from the 8-channel line patrol module through IO.
Experimental wiring
Adruino connected to the serial port assistant can be directly connected using the program download port
| adruino | 8-channel line patrol module |
|---|---|
| 2 | x1 |
| 3 | x2 |
| 4 | x3 |
| 5 | x4 |
| 6 | x5 |
| 7 | x6 |
| 8 | x7 |
| 9 | x8 |
| 5V | 5V |
| GND | GND |
As shown in the figure:

Experimental steps and phenomena
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:

Experimental source code
x
void loop() { x1 = digitalRead(2); x2 = digitalRead(3); x3 = digitalRead(4); x4 = digitalRead(5);
x5 = digitalRead(6); x6 = digitalRead(7); x7 = digitalRead(8); x8 = digitalRead(9);
sprintf(buf,"x1:%d x2:%d x3:%d x4:%d x5:%d x6:%d x7:%d x8:%d",x1,x2,x3,x4,x5,x6,x7,x8); Serial.println(buf);
}The source code reads the IO signal of each probe of the 8-channel line patrol and prints it out.