PaulDFoster / pxt-microbit-GY521

A PXT package for the Microbit to drive a MPU-6050 (GY-521)
1 stars 9 forks source link

microbit_GY521.initialise() is not working #7

Open kangengthao opened 5 years ago

kangengthao commented 5 years ago

Hi, I am a beginner. I try to use microbit javascript to get GY-521 readings. I find microbit_GY521.initialise() is not working and serial.writeNumber(microbit_GY521.readGyroX()); given 0 reading.

microbit_GY521.initialise();

if (microbit_GY521.testConnection()) serial.writeLine("GY521 connected"); else serial.writeLine("GY521 not found");

// supply your own gyro offsets here, scaled for min sensitivity // These don't appear to get set, as the get values differ microbit_GY521.setXGyroOffset(-96); let xgo = microbit_GY521.getXGyroOffset(); serial.writeString("xgo -96 "); serial.writeNumber(xgo); serial.writeLine(" "); microbit_GY521.setYGyroOffset(54); //54 let ygo = microbit_GY521.getYGyroOffset(); serial.writeString("ygo 54 "); serial.writeNumber(ygo); serial.writeLine(" "); microbit_GY521.setZGyroOffset(87); //128 let zgo = microbit_GY521.getZGyroOffset(); serial.writeString("zgo 87 "); serial.writeNumber(zgo); serial.writeLine(" "); microbit_GY521.setZAccelOffset(1393); // 1688 factory default for my test chip let zao = microbit_GY521.getZAccelOffset(); serial.writeString("zao 1393 "); serial.writeNumber(zao); serial.writeLine(" ");

//Test raw reads microbit_GY521.getMotion6(); serial.writeNumber(microbit_GY521.readGyroX()); serial.writeString(" "); serial.writeNumber(microbit_GY521.readGyroY()); serial.writeString(" "); serial.writeNumber(microbit_GY521.readGyroZ()); serial.writeString(" "); serial.writeNumber(microbit_GY521.readAccelX()); serial.writeString(" "); serial.writeNumber(microbit_GY521.readAccelY()); serial.writeString(" "); serial.writeNumber(microbit_GY521.readAccelZ()); serial.writeLine(" ");

allanckw commented 2 years ago

@PaulDFoster @pelikhan

Hi, we cant call initialize, can you at least let us know how to fix it?

pelikhan commented 2 years ago

Pull request?

PaulDFoster commented 2 years ago

@PaulDFoster @pelikhan

Hi, we cant call initialize, can you at least let us know how to fix it?

Hi. Please give more context. You can't call initialize successfully?

GitCloneJames commented 1 year ago

I think the issue is that MakeCode will error because 'Property 'initialise' does not exist on type 'typeof microbit_GY521'.' It doesn't seem to be exposed in the extension.ts