Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion to sleep function of MPU6050 #17

Open
cedricwritescode opened this issue Dec 31, 2018 · 0 comments
Open

Suggestion to sleep function of MPU6050 #17

cedricwritescode opened this issue Dec 31, 2018 · 0 comments

Comments

@cedricwritescode
Copy link

cedricwritescode commented Dec 31, 2018

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);

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant