lorawan/sodaq_one/compass.ino
Nico Schottelius 95d8e8bfe5 update
Signed-off-by: Nico Schottelius <nico@wurzel.schottelius.org>
2016-10-27 18:14:29 +02:00

28 lines
549 B
C++

#include <Wire.h>
#include <LSM303.h>
LSM303 compass;
void setupCompass()
{
Wire.begin();
compass.init();
compass.enableDefault();
}
String getCompass()
{
String tmps;
compass.read();
tmps = String("compass.a.x=" ) + compass.a.x +
String(" compass.a.y=" ) + compass.a.y +
String(" compass.a.z=" ) + compass.a.z +
String(" compass.m.x=" ) + compass.m.x +
String(" compass.m.y=" ) + compass.m.y +
String(" compass.m.z=" ) + compass.m.z;
debugSerial.println(tmps);
return tmps;
}