From 4c2889a900abcd10d14881eb066a8cb16260ccd1 Mon Sep 17 00:00:00 2001 From: Shiva Varun <92519151+ShivaVarun-Adicherla@users.noreply.github.com> Date: Sat, 21 Oct 2023 23:23:55 +0530 Subject: [PATCH] Update MPU6050_DMP6.ino to stop Serial Freezes --- Arduino/MPU6050/examples/MPU6050_DMP6/MPU6050_DMP6.ino | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Arduino/MPU6050/examples/MPU6050_DMP6/MPU6050_DMP6.ino b/Arduino/MPU6050/examples/MPU6050_DMP6/MPU6050_DMP6.ino index 3ebe2ee6..9b7c7aba 100644 --- a/Arduino/MPU6050/examples/MPU6050_DMP6/MPU6050_DMP6.ino +++ b/Arduino/MPU6050/examples/MPU6050_DMP6/MPU6050_DMP6.ino @@ -71,6 +71,12 @@ MPU6050 mpu; digital I/O pin 2. * ========================================================================= */ +/* ========================================================================= + NOTE: If you are experiencing Freezes in the Serial then make sure you + pull down the AD0 pin and don't leave it floating. Some cheapo boards + now don't do this anymore. + * ========================================================================= */ + /* ========================================================================= NOTE: Arduino v1.0.1 with the Leonardo board generates a compile error when using Serial.write(buf, len). The Teapot output uses this method. @@ -167,6 +173,7 @@ void setup() { #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE Wire.begin(); Wire.setClock(400000); // 400kHz I2C clock. Comment this line if having compilation difficulties + Wire.setWireTimeout(3000, true); //timeout value in uSec. Used to fix Serial Freezing after few secs #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE Fastwire::setup(400, true); #endif