function start(){
I2C1.setup({scl:B6,sda:B7});
var mpu = require("MPU6050").connect(I2C1);
setInterval(() => {
console.log(
'\nAcceleration:', mpu.getAcceleration(), // returns an [x,y,z] array with raw accl. data
'\nGravity:', mpu.getGravity(), // returns acceleration array in G's
'\nRotation:', mpu.getRotation(), // returns an [x,y,z] array with raw gyro data
'\nDegress per second:', mpu.getDegreesPerSecond() // returns gyro array in degrees/s
);
}, 1000);
}//end start
//Wait for program to load
setTimeout(function () {
start();
}, 1000);
Without an MPU6050 connected to the PICO I get the following:
1v92 Copyright 2016 G.Williams
>
=undefined
Uncaught InternalError: Timeout on I2C Write Transmit Mode 2
at line 1 col 29
this.i2c.writeTo(this.addr,a);return this.i2c.readFrom(this....
^
in function "readBytes" called from line 1 col 25
var g=this.readBytes(a,1)[0],h=(1<<b)-1<<c-b+1,g=g&~h|d<<c-b...
^
in function "writeBits" called from line 2 col 41
d.PWR1_CLKSEL_BIT,d.PWR1_CLKSEL_LENGTH,a)
^
in function "setClockSource" called from line 1 col 38
...ockSource(d.CLOCK_PLL_XGYRO);this.setFullScaleAccelRange(d.A...
^
in function "initialize" called from line 1 col 103
...AD0_HIGH:c;this.initialize()
^
in function "b" called from line 1 col 10
new b(a,c)
^
in function "connect" called from line 3 col 42
var mpu = require("MPU6050").connect(I2C1);
^
in function "start" called from line 1 col 7
start();
^
in fun
Please try it with your chip connected.
As for the connections, I use similar prototype connections for testing. For long term reliability soldered connections are the best. Loose connections cause headaches.
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.
MPU6050 Try this code
Without an MPU6050 connected to the PICO I get the following:
Please try it with your chip connected.
As for the connections, I use similar prototype connections for testing. For long term reliability soldered connections are the best. Loose connections cause headaches.