1
- #include < MPU9250_asukiaaa.h>
2
-
3
- #ifdef _ESP32_HAL_I2C_H_
4
- #define SDA_PIN 21
5
- #define SCL_PIN 22
6
- #endif
1
+ /* Heltec Automation MPU9520 Sensors test example
2
+ *
3
+ * Function:
4
+ * 9-axis sensor
5
+ *
6
+ * Description:
7
+ * 1.The MPU9250 integrates a 3-axis gyroscope, a 3-axis accelerometer,
8
+ * and a 3-axis magnetometer. The output is 16-bit digital.
9
+ *
10
+ * 2. Data can be exchanged via the Integrated Circuit Bus (IIC) interface
11
+ * and the microcontroller with a transfer rate of up to 400 kHz / s.
12
+ *
13
+ * 3. The accelerometer's measurement range is up to ??16g (g is gravitational
14
+ * acceleration), and the static measurement accuracy is high.
15
+ *
16
+ * 4. The magnetometer uses a high-intensity Hall-type sensor for data acquisition.
17
+ * The magnetic induction measurement range is ??4800??T, which can be used for auxiliary
18
+ * measurement of yaw angle.
19
+ *
20
+ * 5.The MPU9250's built-in digital motion processor (DMP: Hardware Motion Processor)
21
+ * hardware acceleration engine integrates nine-axis sensor data and outputs
22
+ * complete 9-axis fusion calculation data to the application.
23
+ *
24
+ * HelTec AutoMation, Chengdu, China
25
+ * www.heltec.org
26
+ *
27
+ * this project also realess in GitHub:
28
+ * https://github.com/HelTecAutomation/ASR650x-Arduino
29
+ *
30
+ * MPU9250 Get Mag Offset original project available here: https://github.com/asukiaaa/MPU9250_asukiaaa
31
+ */
32
+
33
+ #include < MPU9250.h>
7
34
8
35
#define CALIB_SEC 20
9
36
10
- MPU9250_asukiaaa mySensor;
37
+ MPU9250 mySensor;
11
38
12
39
uint8_t sensorId;
13
40
float mDirection , mX , mY , mZ ;
@@ -17,12 +44,6 @@ void setup() {
17
44
while (!Serial);
18
45
Serial.println (" started" );
19
46
20
- #ifdef _ESP32_HAL_I2C_H_ // For ESP32
21
- Wire.begin (SDA_PIN, SCL_PIN); // SDA, SCL
22
- #else
23
- Wire.begin ();
24
- #endif
25
-
26
47
mySensor.setWire (&Wire);
27
48
while (mySensor.readId (&sensorId) != 0 ) {
28
49
Serial.println (" Cannot find device to read sensorId" );
@@ -38,7 +59,7 @@ void setup() {
38
59
Serial.println (" Finished setting offset values." );
39
60
}
40
61
41
- void setMagMinMaxAndSetOffset (MPU9250_asukiaaa * sensor, int seconds) {
62
+ void setMagMinMaxAndSetOffset (MPU9250 * sensor, int seconds) {
42
63
unsigned long calibStartAt = millis ();
43
64
float magX, magXMin, magXMax, magY, magYMin, magYMax, magZ, magZMin, magZMax;
44
65
@@ -85,4 +106,4 @@ void loop() {
85
106
Serial.println (" at " + String (millis ()) + " ms" );
86
107
Serial.println (" " ); // Add an empty line
87
108
delay (500 );
88
- }
109
+ }
0 commit comments