lorawan/sodaq_one/compass.ino
Nico Schottelius 70bd008498 Cleanup
2016-10-24 21:34:02 +02:00

23 lines
396 B
C++

#include <Wire.h>
#include <LSM303.h>
LSM303 compass;
char compassReport[80];
void setupCompass()
{
Wire.begin();
compass.init();
compass.enableDefault();
}
void readCompass()
{
compass.read();
snprintf(compassReport, sizeof(compassReport), "A: %6d %6d %6d M: %6d %6d %6d",
compass.a.x, compass.a.y, compass.a.z,
compass.m.x, compass.m.y, compass.m.z);
}