I'm not sure about how to read the OPT3001 sensor's data and i didn't find a lot of documentation. Here my code and the error i have on output.
My code :
var i2c = new I2C();
i2c.setup({sda:B9,scl:B8});
var opt = require("OPT3001").connectI2C(i2c);
// default adresse (0x44) and pins are ok, connection works
var data = opt.read();
console.log(JSON.stringify(data,null,2));
Output :
>new Uint8Array([84, 73])
21577
new Uint8Array([48, 1])
12289
>Uncaught TypeError: Expecting a number or something iterable, got undefined
at line 1 col 14
a.writeTo(e,c);c=a.readFrom(e,2);print(c);return c[1]|c[0]<<...
^
in function "r" called from line 1 col 17
this.r(a.RESULT0)
^
in function "read" called from line 1 col 21
var data = opt.read();
^
>
The module is right connected and seems ready (led on). Can someone help me ?
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.
Hello,
I'm not sure about how to read the OPT3001 sensor's data and i didn't find a lot of documentation. Here my code and the error i have on output.
My code :
Output :
The module is right connected and seems ready (led on). Can someone help me ?