Last active
August 29, 2015 14:16
-
-
Save cat-haines/ce78ab030e4017a803f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
device.on("data", function(data) { | |
server.log(http.jsonencode(data)); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/electricimp/lsm9ds0 | |
#require "LSM9DS0.class.nut:1.0" | |
i2c <- hardware.i2c89; | |
i2c.configure(CLOCK_SPEED_400_KHZ); | |
imu <- LSM9DS0(i2c); | |
function poll() { | |
imp.wakeup(1,poll); | |
local acc = imu.getAccel(); | |
local mag = imu.getMag(); | |
local gyr = imu.getGyro(); | |
agent.send("data", { | |
acc = acc, | |
mag = mag, | |
gyr = gyr | |
}); | |
} | |
/* RUNTIME START ------------------------------------------------------------ */ | |
poll(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment