MPU6050_tockn icon indicating copy to clipboard operation
MPU6050_tockn copied to clipboard

Suggestion to sleep function of MPU6050

Open cedricwritescode opened this issue 5 years ago • 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);

}

cedricwritescode avatar Dec 31 '18 09:12 cedricwritescode