//#include #include #include MPU6050 mpu(Wire); #include SoftwareSerial bluetooth(6, 7); // RX, TX #include #include "SolomonSystech.h" // ============================================================================ void setup() { // set the data rate for the SoftwareSerial port bluetooth.begin(9600); // put your setup code here, to run once: oled.begin(128, 64, sizeof(tiny4koled_init_128x64r), tiny4koled_init_128x64r); // To save space, the bitmap is cropped left and right, // intended to be drawn onto a clear screen oled.clear(); // Now that the display is all setup, turn on the display oled.on(); Serial.begin(9600); Wire.begin(); byte status = mpu.begin(); Serial.print(F("MPU6050 status: ")); Serial.println(status); while (status != 0) { } // stop everything if could not connect to MPU6050 Serial.println(F("Calculating offsets, do not move MPU6050")); delay(1000); mpu.calcOffsets(); // gyro and accelero Serial.println("Done!\n"); } void loop() { mpu.update(); delay(50); float angley = mpu.getAngleY(); // declare the angle Y of the gyro on the variable angle float anglex = mpu.getAngleX(); // declare the angle X of the gyro on the variable angle // This example only shows a static image on the display. // The microcontroller could be turned off now. Serial.print(angley); Serial.print(":"); Serial.println(anglex); oled.bitmap(0, 0, 128 , 8, sadface_bitmap); delay (1000); oled.bitmap(0, 0, 128 , 8, happyface_bitmap); delay (1000); }