|
@@ -1,10 +1,16 @@
|
|
- #include "I2Cdev.h"
|
|
|
|
|
|
+// #include "I2Cdev.h"
|
|
#include "MPU6050.h"
|
|
#include "MPU6050.h"
|
|
|
|
|
|
-#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
|
|
|
|
|
|
+
|
|
|
|
+//#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
|
|
#include "Wire.h"
|
|
#include "Wire.h"
|
|
-#endif
|
|
|
|
- #include "struct.h"
|
|
|
|
|
|
+//#endif
|
|
|
|
+
|
|
|
|
+#include <LiquidCrystal_I2C.h>
|
|
|
|
+LiquidCrystal_I2C lcd(0x27,16,4); // set the LCD address to 0x27 or 0x20
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// #include "struct.h"
|
|
|
|
|
|
#include <QMC5883LCompass.h>
|
|
#include <QMC5883LCompass.h>
|
|
QMC5883LCompass compass;
|
|
QMC5883LCompass compass;
|
|
@@ -27,12 +33,11 @@ bool blinkState = false;
|
|
|
|
|
|
void setup()
|
|
void setup()
|
|
{
|
|
{
|
|
-
|
|
|
|
- #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
|
|
|
|
|
|
+ //#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
|
|
Wire.begin();
|
|
Wire.begin();
|
|
- #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
|
|
|
|
- Fastwire::setup(400, true);
|
|
|
|
- #endif
|
|
|
|
|
|
+ //#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
|
|
|
|
+ // Fastwire::setup(400, true);
|
|
|
|
+ //#endif
|
|
Serial.begin(115200);
|
|
Serial.begin(115200);
|
|
while (!Serial); // Waiting for Serial Monitor
|
|
while (!Serial); // Waiting for Serial Monitor
|
|
Serial.println("\nCompass ang gyro test ");
|
|
Serial.println("\nCompass ang gyro test ");
|
|
@@ -48,9 +53,11 @@ void setup()
|
|
|
|
|
|
pinMode(LED_PIN, OUTPUT);
|
|
pinMode(LED_PIN, OUTPUT);
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- // setZeroMotionDetectionThreshold(154);
|
|
|
|
|
|
+//lcd.backlight();
|
|
|
|
+//lcd.setCursor(3,0);
|
|
|
|
+//lcd.print("Hello, world!");
|
|
|
|
+ #include "LiquidCrystal_I2C_setup.h"
|
|
|
|
+// setZeroMotionDetectionThreshold(154);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -96,6 +103,8 @@ Serial.println();
|
|
Serial.write((uint8_t)(gz >> 8)); Serial.write((uint8_t)(gz & 0xFF));
|
|
Serial.write((uint8_t)(gz >> 8)); Serial.write((uint8_t)(gz & 0xFF));
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+
|
|
|
|
+ #include "LiquidCrystal_I2C_loop.h"
|
|
delay(1500);
|
|
delay(1500);
|
|
|
|
|
|
}
|
|
}
|