Skip to content

Instantly share code, notes, and snippets.

@gyengus
Last active August 29, 2015 14:23
Show Gist options
  • Save gyengus/9dbee43b755aebdcd56e to your computer and use it in GitHub Desktop.
Save gyengus/9dbee43b755aebdcd56e to your computer and use it in GitHub Desktop.
Espruino Pico BMP180 example
I2C1.setup({scl: B6, sda: B7});
var bmp = require("BMP085").connect(I2C1, 3);
function readBTN() {
if (digitalRead(BTN1) == 1) {
LED1.write(true);
bmp.getPressure(function(d) {
console.log(new Date().toString());
console.log("Pressure: " + d.pressure + " Pa");
console.log("Temperature: " + d.temperature + " °C");
LED1.write(false);
});
}
}
setWatch(readBTN, BTN1, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment