#include <LiquidCrystal_I2C.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_MPU6050.h>
// set the LCD number of columns and rows
int lcdColumns = 16;
int lcdRows = 2;
int a;
bool status;
// set LCD address, number of columns and rows
// if you don't know your display address, run an I2C scanner sketch
LiquidCrystal_I2C lcd(0x27, lcdColumns, lcdRows);
// set I2C address of MPU6050 sensor
Adafruit_MPU6050 mpu;
void setup(){
// initialize LCD
lcd.init();
// turn on LCD backlight
lcd.backlight();
}
sensors_event_t event;
void loop(){
status = mpu.begin(0x68);
mpu.begin(0x68);
mpu.getAccelerometerSensor()->getEvent(&event);
// set cursor to first column, first row
lcd.setCursor(0, 0);
// print message
// Serial.println(event.acceleration.x);
lcd.print(event.acceleration.x);
delay(1000);
// clears the display to print new message
lcd.clear();
// set cursor to first column, second row
lcd.setCursor(1,1);
lcd.print("Hello, World!");
delay(1000);
lcd.clear();
if (status ==1)
{
lcd.print("yes");
delay(1000);
lcd.clear();
}
else
{
lcd.print("no");
delay(1000);
lcd.clear();
}
}