This example actively triggers measurements of the magnetic field. After each sensor read, the chip goes automatically back into standby mode.
#include <iostream>
#include <chrono>
#include <thread>
#include "mag3110.hpp"
int main(int argc, char** argv)
{
int bx, by, bz;
while (true) {
cout << (mag.
isActive() ?
"Mode: active" :
"Mode: standby") << endl;
this_thread::sleep_for(chrono::seconds(1));
}
return 0;
}