tockn/MPU6050_tockn

Suggestion to sleep function of MPU6050

Opened this issue · 0 comments

I've written a function for the library that reduces current need.
It sets the MPU6050 in low power/sleep mode and disables the sensors.
You have still access to the registers.

void MPU6050::sleep(bool sleep)
{
byte b = readMPU6050(0x6B);
bitWrite(b, 6, sleep);
writeMPU6050(0x6B, b);

b = readMPU6050(0x6C);
for(uint8_t i = 0; i < 6; i ++)
{
	bitWrite(b, i, sleep);
}
writeMPU6050(0x6C, b);

}