Interfacing to GY-291 #389
Unanswered
espruino-discuss2
asked this question in
Interfacing
Replies: 1 comment
-
Posted at 2014-02-11 by @gfwilliams The 'Internal Error' is actually just because the I2C device doesn't respond - it's not actually an internal error (there's a bug open to rename it!) It's probably either electrical (no pullup resistors, sda/scl the wrong way around) or because the address is wrong. Have you tried just using 0x53? (0x53>>1) actually loses one bit, so my guess is that's probably not what you want. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2014-02-11 by JumJum
Based on this article I tried to connect the accelerometer to my Espruino board. Wrote some lines and get an error
INTERNAL ERROR: Timeout on I2C Write Transmit Mode 2
INTERNAL ERROR: Timeout on I2C Write Transmit
at line 2 col 33
this.i2c.writeTo(id,reg | 0x80);
´´´
function GY291(i2c,sda,scl){
this.i2c = i2c;
var id = 0x53>>1;
this.i2c.setup({scl:scl,sda:sda});
}
GY291.prototype.write = function(reg,val){
this.i2c.writeTo(this.id,[reg,val]);
};
GY291.prototype.read = function(reg,count){
this.i2c.writeTo(id,reg | 0x80);
return this.i2c.readFrom(id,count);
};
GY291.prototype.turnOn = function(){
this.write(0x2d,0);
this.write(0x2d,16);
this.write(0x2d,8);
};
var a = new GY291(I2C2,B11,B10);
setInterval(function(){
var c = a.read(0x32,6);
console.log(c);
},2000);
´´´
Beta Was this translation helpful? Give feedback.
All reactions