[Diao Ye learns programming] Arduino hands-on (147)---QMC5883L three-axis compass module 2

The reference to 37 sensors and actuators has been widely circulated on the Internet. In fact, there must be more than 37 sensor modules compatible with Arduino. In view of the fact that I have accumulated some sensor and actuator modules on hand, according to the concept of practice to get true knowledge (must be done), for the purpose of learning and communication, I am going to try a series of experiments one by one, regardless of success (the program goes through) or not, They will be recorded - small progress or unsolvable problems, hoping to inspire others.

[Arduino] 168 sensor module series experiments (data code + simulation programming + graphic programming)
Experiment 147: QMC5883L electronic compass compass module three-axis magnetic field sensor GY-271

insert image description here
insert image description here
Made a compass orientation diagram

The value range of the compass direction in this experiment is 0~11, the north point is 0, the east point is 3, the south point is 6, and the west point is 9. The letter representations of the four directions of East (East), West (West), South (South), and North (North) are determined according to the initials of their English words.

insert image description here
[Arduino] 168 sensor module series experiments (data code + simulation programming + graphics programming)

Experiment 147: QMC5883L electronic compass compass module three-axis magnetic field sensor GY-271

Install library: IDE – Tools – Manage Library – Search for “QMC5883L” – Install QMC5883LCompass

Item: indoor measurement azimuth angle (value between 0-359 degrees)

Experimental open source code

/*

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)

 实验一百四十七:QMC5883L电子指南针罗盘模块 三轴磁场传感器GY-271

 1、安装库:IDE--工具--管理库--搜索“QMC5883L”--安装QMC5883LCompass

 2、项目:简易测量方位角度(数值在0-359度之间)

 3、实验接线:

 QMC5883L-------------- UNO

 VCC------------------- 5V

 GND------------------- GND

 SCL ------------------- A5

 SDA------------------- A4

 DRDY------------------ N/C

*/



#include <QMC5883LCompass.h>

QMC5883LCompass compass;

void setup() {
    
    

 Serial.begin(9600);

 compass.init();

}

void loop() {
    
    

 int a;

 // 读取罗盘值

 compass.read();

 // 返回方位角读数

 a = compass.getAzimuth();

 Serial.print("地磁方位角: ");

 Serial.print(a);

 Serial.print("°");

 Serial.println();

 delay(500);

}

Experimental serial port return

insert image description here
Arduino experiment scene diagram

insert image description here
Experimental serial port plotter return status

insert image description here
[Arduino] 168 sensor module series experiments (data code + simulation programming + graphics programming)

Experiment 147: QMC5883L electronic compass compass module three-axis magnetic field sensor GY-271

Item Six: Test Direction

Experimental open source code

/*

【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)

 实验一百四十七:QMC5883L电子指南针罗盘模块 三轴磁场传感器GY-271

 项目之六:测试方向

 实验接线:

 QMC5883L-------------- UNO

 VCC------------------- 5V

 GND------------------- GND

 SCL ------------------- A5

 SDA------------------- A4

 DRDY------------------ N/C

*/



#include <QMC5883LCompass.h>

QMC5883LCompass compass;

void setup() {
    
    

 Serial.begin(9600);

 compass.init();

}

void loop() {
    
    

 compass.read();

 byte a = compass.getAzimuth();

 char myArray[3];

 compass.getDirection(myArray, a);

 Serial.print(myArray[0]);

 Serial.print(myArray[1]);

 Serial.print(myArray[2]);

 Serial.println();

 delay(250);

}


Experimental serial port return

insert image description here

[Arduino] 168 sensor module series experiments (data code + simulation programming + graphic programming)
Experiment 147: QMC5883L electronic compass compass module three-axis magnetic field sensor GY-271
project seven: three-axis XYZ real-time data

Experimental open source code

/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
 实验一百四十七:QMC5883L电子指南针罗盘模块 三轴磁场传感器GY-271
  项目之七:三轴XYZ实时数据
  实验接线:
  5883L-------------- UNO
  VCC------------------- 5V
  GND------------------- GND
  SCL ------------------- A5
  SDA------------------- A4
  DRDY------------------ N/C
*/

#include <QMC5883LCompass.h>

QMC5883LCompass compass;

void setup() {
    
    
  Serial.begin(9600);
  Serial.print("5883L准备就绪");
  compass.init();

  /*
     调用 setSmoothing(STEPS, ADVANCED);

     STEPS = int 平滑结果的步数。有效 1 到 10。
     更高的步骤等于更平滑但更长的处理时间。

     ADVANCED = bool 打开或关闭高级平滑。True 将从每个步骤中删除最大值和最小值,然后正常处理。
     启用此功能将导致更加平滑,但需要更长的处理时间。

  */
  compass.setSmoothing(10, true);
}

void loop() {
    
    
  int x, y, z;

  // Read compass values
  compass.read();

  // Return XYZ readings
  x = compass.getX();
  y = compass.getY();
  z = compass.getZ();

  Serial.print("X: ");
  Serial.print(x);
  Serial.print(" Y: ");
  Serial.print(y);
  Serial.print(" Z: ");
  Serial.print(z);
  Serial.println();

  delay(250);
}

Experimental serial port return
insert image description here

Experimental serial port plotter return status
insert image description here
[Arduino] 168 sensor module series experiments (data code + simulation programming + graphic programming)
Experiment 147: QMC5883L electronic compass compass module three-axis magnetic field sensor GY-271
Project 8: Simple QMC5883L compass demo
experimental open source code

/*
 【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
   实验一百四十七:QMC5883L电子指南针罗盘模块 三轴磁场传感器GY-271
   项目之八:简单的QMC5883L 指南针演示
   实验接线:
   5883L-------------- UNO
   VCC------------------- 5V
   GND------------------- GND
   SCL ------------------- A5
   SDA------------------- A4
   DRDY------------------ N/C
*/

#include <QMC5883L.h>
#include <Wire.h>

QMC5883L compass;

void setup() {
    
    
  Wire.begin();

  compass.init();
  compass.setSamplingRate(50);

  Serial.begin(9600);
  Serial.println("QMC5883L 指南针演示");
  Serial.println("向各个方向转动罗盘来校准....");
}

void loop(){
    
    
  int heading = compass.readHeading();
  if (heading == 0) {
    
    
    /* Still calibrating, so measure but don't print */
  } else {
    
    
    Serial.println(heading);
  }
  delay(250);
}

Experimental serial port return
insert image description here

[Arduino] 168 kinds of sensor module series experiments (data code + simulation programming + graphic programming)
experiment 147: QMC5883L electronic compass compass module three-axis magnetic field sensor GY-271
project nine: dynamic four sets of data, xyz+ azimuth a

Experimental open source code

/*
 【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
   实验一百四十七:QMC5883L电子指南针罗盘模块 三轴磁场传感器GY-271
   项目之九:动态四组数据,xyz+方位角
   实验接线:
   5883L-------------- UNO
   VCC------------------- 5V
   GND------------------- GND
   SCL ------------------- A5
   SDA------------------- A4
   DRDY------------------ N/C
*/

#include <Wire.h>
#include <MechaQMC5883.h>

MechaQMC5883 qmc;

void setup() {
    
    
  Wire.begin();
  Serial.begin(9600);
  qmc.init();
  //qmc.setMode(Mode_Continuous,ODR_200Hz,RNG_2G,OSR_256);
}

void loop() {
    
    
  int x, y, z;
  int azimuth;
  //float azimuth; //is supporting float too
  qmc.read(&x, &y, &z, &azimuth);
  //azimuth = qmc.azimuth(&y,&x);//you can get custom azimuth
  Serial.print("x: ");
  Serial.print(x);
  Serial.print(" y: ");
  Serial.print(y);
  Serial.print(" z: ");
  Serial.print(z);
  Serial.print(" a: ");
  Serial.print(azimuth);
  Serial.println();
  delay(800);
}

Experimental serial port return

insert image description here

Experimental serial port plotter return status

insert image description here

Module experiment wiring diagram
insert image description here
Magnetic declination (magnetic declination)
Geomagnetic declination refers to the angle between the magnetic north direction and the true north direction anywhere on the earth. When the geomagnetic north is actually eastward, the geomagnetic declination is positive, otherwise it is negative. The geomagnetic declination was first recorded by Chinese scientist Shen Kuo in the Northern Song Dynasty in the book "Mengxi Bi Tan": "The Fang family used a magnet to sharpen the needle, and then it can guide the direction, but it is often slightly eastward, not completely south." The earliest in the West Records are about 400 years after that. In different places on the earth, the geomagnetic declination is generally not the same. In the same place, the magnetic declination changes over time. When a magnetic storm occurs and in areas with magnetic anomalies, such as near magnetite and high-voltage lines, the geomagnetic declination will change sharply. In most parts of mainland China, the geomagnetic declination is between -10° and +2°. In Taiwan, it is about -4°~-3°. True North (True North TN):

insert image description here

Square grid north (Figure North GN): Take the azimuth angle measured by the grid north line as the grid azimuth.
Magnetic north (MN): Geomagnetic declination: When the local magnetic north is actually eastward, the geomagnetic declination is positive, otherwise it is negative.
insert image description here

The direction pointed by the north needle is magnetic north (MN). Assuming that the magnetic declination is 14 degrees east (14°E), true north (TN) will be 14 degrees to the right of magnetic north (MN). xx°E: true north is xx degrees to the right of magnetic north. xx°W: true north is xx degrees to the left of magnetic north.
insert image description here
Magnetic declination is a correction applied based on your current location
to get true north from magnetic north, and it varies from place to place.
Example:
Christchurch, 23° 35'
E Wellington, 22° 14' EAST
Dunedin, 25° 8'
E Auckland, 19° 30' E

Magnetic declination for your area can be obtained from http://www.magnetic-declination.com/

insert image description here

Actual measurement of magnetic declination in several places

insert image description here
insert image description here
insert image description here
insert image description here

[Arduino] 168 sensor module series experiments (data code + simulation programming + graphic programming)
Experiment 147: QMC5883L electronic compass compass module three-axis magnetic field sensor GY-271
Project 10: Correct the magnetic declination according to the current position

Experimental open source code

/*
 【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
   实验一百四十七:QMC5883L电子指南针罗盘模块 三轴磁场传感器GY-271
   项目之十:根据当前位置来校正磁偏角
   实验接线:
   5883L-------------- UNO
   VCC------------------- 5V
   GND------------------- GND
   SCL ------------------- A5
   SDA------------------- A4
   DRDY------------------ N/C
*/

#include <Arduino.h>
#include <Wire.h>
#include <HMC5883L_Simple.h>

// Create a compass
HMC5883L_Simple Compass;

void setup() {
    
    
  Serial.begin(9600);
  Wire.begin();

  // Magnetic Declination is the correction applied according to your present location
  // in order to get True North from Magnetic North, it varies from place to place.
  //
  // The declination for your area can be obtained from http://www.magnetic-declination.com/
  // Take the "Magnetic Declination" line that it gives you in the information,
  //
  // Examples:
  //   Christchurch, 23° 35' EAST
  //   Wellington  , 22° 14' EAST
  //   Dunedin     , 25° 8'  EAST
  //   Auckland    , 19° 30' EAST
  //
  Compass.SetDeclination(-0, 23, 'W');

  //   The device can operate in SINGLE (default) or CONTINUOUS mode
  //   SINGLE simply means that it takes a reading when you request one
  //   CONTINUOUS means that it is always taking readings
  //   for most purposes, SINGLE is what you want.
  Compass.SetSamplingMode(COMPASS_CONTINUOUS);

  //   The scale can be adjusted to one of several levels, you can probably leave it at the default.
  //   Essentially this controls how sensitive the device is.
  //   Options are 088, 130 (default), 190, 250, 400, 470, 560, 810
  //   Specify the option as COMPASS_SCALE_xxx
  //   Lower values are more sensitive, higher values are less sensitive.
  //   The default is probably just fine, it works for me.  If it seems very noisy
  //  (jumping around), incrase the scale to a higher one.
  Compass.SetScale(COMPASS_SCALE_250);

  //   The compass has 3 axes, but two of them must be close to parallel to the earth's surface to read it,
  //   (we do not compensate for tilt, that's a complicated thing) - just like a real compass has a floating
  //   needle you can imagine the digital compass does too.
  //
  //   To allow you to mount the compass in different ways you can specify the orientation:
  //   COMPASS_HORIZONTAL_X_NORTH (default), the compass is oriented horizontally, top - side up. when pointing North the X silkscreen arrow will point North
  //   COMPASS_HORIZONTAL_Y_NORTH, top-side up, Y is the needle,when pointing North the Y silkscreen arrow will point North
  //   COMPASS_VERTICAL_X_EAST,    vertically mounted (tall) looking at the top side, when facing North the X silkscreen arrow will point East
  //   COMPASS_VERTICAL_Y_WEST,    vertically mounted (wide) looking at the top side, when facing North the Y silkscreen arrow will point West
  Compass.SetOrientation(COMPASS_HORIZONTAL_X_NORTH);
}

// Our main program loop.
void loop() {
    
    
  float heading = Compass.GetHeadingDegrees();

  Serial.print("Heading: \t");
  Serial.println( heading );
  delay(500);
}

Experimental serial port return status
Project tenth experiment description: This is the second time that the calibration of magnetic declination cannot be completed. The
first time is to use the library of QMC5883L, this time is to use the library of HMC5883L, and the chip used in the experiment is the domestic DB5883L
. There are three chips from different manufacturers with certain differences. It is estimated that there are some incompatibility in the calibration procedure, and no incompatibility has been found in other functions.

insert image description here

[Arduino] 168 sensor module series experiments (data code + simulation programming + graphic programming)
Experiment 147: QMC5883L electronic compass compass module three-axis magnetic field sensor GY-271
Project 11: HMC5883 magnetometer test using Adafruit library

Experimental open source code

/*
 【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
   实验一百四十七:QMC5883L电子指南针罗盘模块 三轴磁场传感器GY-271
   项目十一:使用Adafruit库的HMC5883 磁力计测试
   实验接线:
   5883L-------------- UNO
   VCC------------------- 5V
   GND------------------- GND
   SCL ------------------- A5
   SDA------------------- A4
   DRDY------------------ N/C
*/

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_HMC5883_U.h>

/* Assign a unique ID to this sensor at the same time */
Adafruit_HMC5883_Unified mag = Adafruit_HMC5883_Unified(666666);

void displaySensorDetails(void)
{
    
    
  sensor_t sensor;
  mag.getSensor(&sensor);
  Serial.println("------------------------------------");
  Serial.print  ("Sensor:       "); Serial.println(sensor.name);
  Serial.print  ("Driver Ver:   "); Serial.println(sensor.version);
  Serial.print  ("Unique ID:    "); Serial.println(sensor.sensor_id);
  Serial.print  ("Max Value:    "); Serial.print(sensor.max_value); Serial.println(" uT");
  Serial.print  ("Min Value:    "); Serial.print(sensor.min_value); Serial.println(" uT");
  Serial.print  ("Resolution:   "); Serial.print(sensor.resolution); Serial.println(" uT");
  Serial.println("------------------------------------");
  Serial.println("");
  delay(500);
}

void setup(void)
{
    
    
  Serial.begin(9600);
  Serial.println("HMC5883 Magnetometer Test"); Serial.println("");

  /* Initialise the sensor */
  if (!mag.begin())
  {
    
    
    /* There was a problem detecting the HMC5883 ... check your connections */
    Serial.println("Ooops, no HMC5883 detected ... Check your wiring!");
    while (1);
  }

  /* Display some basic information on this sensor */
  displaySensorDetails();
}

void loop(void)
{
    
    
  /* Get a new sensor event */
  sensors_event_t event;
  mag.getEvent(&event);

  /* Display the results (magnetic vector values are in micro-Tesla (uT)) */
  Serial.print("X: "); Serial.print(event.magnetic.x); Serial.print("  ");
  Serial.print("Y: "); Serial.print(event.magnetic.y); Serial.print("  ");
  Serial.print("Z: "); Serial.print(event.magnetic.z); Serial.print("  "); Serial.println("uT");

  // Hold the module so that Z is pointing 'up' and you can measure the heading with x&y
  // Calculate heading when the magnetometer is level, then correct for signs of axis.
  float heading = atan2(event.magnetic.y, event.magnetic.x);

  // Once you have your heading, you must then add your 'Declination Angle', which is the 'Error' of the magnetic field in your location.
  // Find yours here: http://www.magnetic-declination.com/
  // Mine is: -13* 2' W, which is ~13 Degrees, or (which we need) 0.22 radians
  // If you cannot find your Declination, comment out these two lines, your compass will be slightly off.
  float declinationAngle = 0.1;
  heading += declinationAngle;

  // Correct for when signs are reversed.
  if (heading < 0)
    heading += 2 * PI;

  // Check for wrap due to addition of declination.
  if (heading > 2 * PI)
    heading -= 2 * PI;

  // Convert radians to degrees for readability.
  float headingDegrees = heading * 180 / M_PI;

  Serial.print("Heading (degrees): "); Serial.println(headingDegrees);

  delay(500);
}

Experimental serial port return
insert image description here
[Arduino] 168 kinds of sensor module series experiment (data code + simulation programming + graphic programming)
experiment 147: QMC5883L electronic compass compass module three-axis magnetic field sensor GY-271
project 12: use simple code Scan the I2C address of the three-axis magnetic field sensor GY-271

Experimental open source code

/*
   【Arduino】168种传感器模块系列实验(资料代码+图形编程+仿真编程)
   实验一百五十八:QMC5883L电子指南针罗盘模块 三轴磁场传感器GY-271
   项目十二:使用简单的代码扫描三轴磁场传感器GY-271的 I2C 地址
   实验接线:
   5883L-------------- UNO
   VCC------------------- 5V
   GND------------------- GND
   SCL ------------------- A5
   SDA------------------- A4
   DRDY------------------ N/C
*/

#include <Wire.h> //include Wire.h library

void setup()
{
    
    
  Wire.begin(); // Wire communication begin
  Serial.begin(9600); // The baudrate of Serial monitor is set in 9600
  while (!Serial); // Waiting for Serial Monitor
  Serial.println("\nI2C Scanner");
}

void loop()
{
    
    
  byte error, address; //variable for error and I2C address
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for (address = 1; address < 127; address++ )
  {
    
    
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
    
    
      Serial.print("I2C device found at address 0x");
      if (address < 16)
        Serial.print("0");
      Serial.print(address, HEX);
      Serial.println("  !");
      nDevices++;
    }
    else if (error == 4)
    {
    
    
      Serial.print("Unknown error at address 0x");
      if (address < 16)
        Serial.print("0");
      Serial.println(address, HEX);
    }
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");

  delay(5000); // wait 5 seconds for the next I2C scan
}

Experimental serial port return

insert image description here

[Arduino] 168 kinds of sensor module series experiments (data code + simulation programming + graphics programming)
Experiment 147: QMC5883L electronic compass compass module three-axis magnetic field sensor GY-271
Project 13: Try not to use the driver library to read XYZ

Experimental open source code

/*
   【Arduino】168种传感器模块系列实验(资料代码+图形编程+仿真编程)
   实验一百五十八:QMC5883L电子指南针罗盘模块 三轴磁场传感器GY-271
   项目十三:尝试不使用驱动库来读取XYZ
   实验接线:
   5883L-------------- UNO
   VCC------------------- 5V
   GND------------------- GND
   SCL ------------------- A5
   SDA------------------- A4
   DRDY------------------ N/C
*/


#include <Wire.h> //I2C Arduino Library

#define HMC5883L_ADDR 0x0D //0011110b, I2C 7bit address of HMC5883

bool haveHMC5883L = false;

bool detectHMC5883L ()
{
    
    
  // read identification registers
  Wire.beginTransmission(HMC5883L_ADDR); //open communication with HMC5883
  Wire.write(10); //select Identification register A
  Wire.endTransmission();
  Wire.requestFrom(HMC5883L_ADDR, 3);
  if(3 == Wire.available()) {
    
    
    char a = Wire.read();
    char b = Wire.read();
    char c = Wire.read();
    if(a == 'H' && b == '4' && c == '3')
      return true;
  }

  return false;
}

void setup()
{
    
    
  //Initialize Serial and I2C communications
  Serial.begin(9600);
  Serial.println("GY271 TEST");
  Wire.begin();
  // lower I2C clock http://www.gammon.com.au/forum/?id=10896
  TWBR = 78;  // 25 kHz 
  TWSR |= _BV (TWPS0);  // change prescaler  
}

void loop()
{
    
    
  bool detect = detectHMC5883L();

  if(!haveHMC5883L) 
  {
    
    
    if(detect) 
    {
    
    
      haveHMC5883L = true;
      Serial.println("We have HMC5883L, moving on");
      // Put the HMC5883 IC into the correct operating mode
      Wire.beginTransmission(HMC5883L_ADDR); //open communication with HMC5883
      Wire.write(0x02); //select mode register
      Wire.write(0x00); //continuous measurement mode
      Wire.endTransmission();
    }
    else
    {
    
      
      Serial.println("No HMC5883L detected!");
      delay(2000);
      return;
    }
  }
  else
  {
    
    
    if(!detect) {
    
    
      haveHMC5883L = false;
      Serial.println("Lost connection to HMC5883L!");
      delay(2000);
      return;
    }
  }
  
  int x,y,z; //triple axis data

  //Tell the HMC5883 where to begin reading data
  Wire.beginTransmission(HMC5883L_ADDR);
  Wire.write(0x0D); //select register 3, X MSB register
  Wire.endTransmission();

 //Read data from each axis, 2 registers per axis
  Wire.requestFrom(HMC5883L_ADDR, 6);
  if(6<=Wire.available()){
    
    
    x = Wire.read()<<8; //X msb
    x |= Wire.read(); //X lsb
    z = Wire.read()<<8; //Z msb
    z |= Wire.read(); //Z lsb
    y = Wire.read()<<8; //Y msb
    y |= Wire.read(); //Y lsb
  }
  
  //Print out values of each axis
  Serial.print("x: ");
  Serial.print(x);
  Serial.print("  y: ");
  Serial.print(y);
  Serial.print("  z: ");
  Serial.println(z);
  
  delay(250);
}

The return status of the experimental serial port (failed to recognize the domestic chip)

insert image description here
[Arduino] 168 sensor module series experiments (data code + simulation programming + graphic programming)
Experiment 147: QMC5883L electronic compass compass module three-axis magnetic field sensor GY-271
Project fourteen: QMC5883LCompass three-axis magnetometer compass sensor

Experimental open source code

/*
   【Arduino】168种传感器模块系列实验(资料代码+图形编程+仿真编程)
   实验一百五十八:QMC5883L电子指南针罗盘模块 三轴磁场传感器GY-271
   项目十四:QMC5883LCompass三轴磁力计罗盘传感器
   实验接线:
   5883L-------------- UNO
   VCC------------------- 5V
   GND------------------- GND
   SCL ------------------- A5
   SDA------------------- A4
   DRDY------------------ N/C
*/

#include <QMC5883LCompass.h>
QMC5883LCompass compass;

void setup(void) {
    
    
  // start serial port
  Serial.begin(115200);
  Serial.println("\n\n\nQMC5883 磁力计测试");
  Serial.println("");
  
  compass.init(); 
}

void loop() {
    
    
int x, y, z, a, b;
  char myArray[3];
  
  compass.read();
  
  x = compass.getX();
  y = compass.getY();
  z = compass.getZ();
  a = compass.getAzimuth();
  b = compass.getBearing(a);
  compass.getDirection(myArray, a);
    
  Serial.print("X: ");
  Serial.print(x);

  Serial.print(" Y: ");
  Serial.print(y);

  Serial.print(" Z: ");
  Serial.print(z);

  Serial.print(" 方位角: ");
  Serial.print(a);

  Serial.print(" 方位: ");
  Serial.print(b);

  Serial.print(" 方向: ");
  Serial.print(myArray[0]);
  Serial.print(myArray[1]);
  Serial.print(myArray[2]);
  Serial.println();
  delay(500);
}

Experimental serial port return

insert image description here
Experimental serial port plotter return status

insert image description here

Arduino experiment scene diagram

insert image description here

Guess you like

Origin blog.csdn.net/weixin_41659040/article/details/131736804