var i2c = new I2C();
i2c.setup({ scl : D25, sda: D26 });
However I doubt that'd have had an effect.
Because they are already in the code lower down. "WHO_AM_I failed" means that it couldn't communicate with the device via I2C (it asked the device what it was, and it didn't return with the code 0x15).
You could try just:
var P = {
HRM_SCL : D25,
HRM_SDA : D26
};
var i = new I2C();
i.setup({scl:P.HRM_SCL,sda:P.HRM_SDA});
function r(a,n) {
i.writeTo(87,a);
return i.readFrom(87,n);
}
print("WHO_AM_I", r(0xFF,1));
And see if you can get it to print something that's not 255 by checking your wiring. That'd be the best way to start.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi - don't add:
However I doubt that'd have had an effect.
Because they are already in the code lower down. "WHO_AM_I failed" means that it couldn't communicate with the device via I2C (it asked the device what it was, and it didn't return with the code 0x15).
You could try just:
And see if you can get it to print something that's not 255 by checking your wiring. That'd be the best way to start.