I'm writing code with the johnny five library to pilote a process. Sometime I find some i2c device not include in the johnny-five library. One of them is the Adafruit AS7262 (https://www.adafruit.com/product/3779)
With johnny-five we could read and write i2c like describe here : http://johnny-five.io/api/board/
With :
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
this.i2cConfig();
this.i2cWrite(0x01, 0x00, [0x02, 0x03]);
});
enter code here
And :
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
this.i2cConfig();
this.i2cRead(0x01, 0x00, 6, function(bytes) {
console.log("Bytes read: ", bytes);
});
});
In the documentation of the Adafruit AS7262 https://cdn-learn.adafruit.com/assets/assets/000/052/623/original/AS7262_DS000486_2-00_%281%29.pdf?1522179774 or in the code of the library for arduino use : https://github.com/adafruit/Adafruit_AS726x/blob/master/Adafruit_AS726x.h
I find some HEX adress that I have try to use for acess the datas from the device but i get nothing and when i put some light on the device the output value doesn't changes here my code :
this.i2cConfig();
this.i2cRead(0x49,0x0D,16,(byte)=>{
console.log("Bytes read : " + byte)
})
0x49 is suppose to be the adress of the device 0x0D is suppose to be the register adress for the value of intensity of green light and I read 16 bytes from there if i well understand but i get this :
Bytes read : 0,0,0,114,64,0,0,0,0,0,0,0,0,0,0,0
And nothing change with light intensity changes (it's work when i run the Arduino library, so the device works)
I try to initiate the device with the write method but i dont understand what put in to make it work.
I never use i2c protocol before so I probably don't understand something basic.