You are reading a single comment by @AkosLukacs and its replies. Click here to read the full conversation.
  • I was able to use the online MPU_6050 module in my project, and now I want to use it as a local module, so I can edit it. I set up my sandbox, and followed the process here:­286424/

    I copied MPU_6050.js to my sandbox\modules folder and names it "MPU_b.js". Then I tried the following project code:

    I2C1.setup({scl:D2, sda:D1, bitrate:100000});
    var mpu, mpuM = require("MPU_b")
    function onInit() {
      mpu = mpuM.connect(I2C1);

    but I'm getting an error:

    Uncaught SyntaxError: Got '=' expected ','
     at line 263 col 65
    ...ction(bank, prefetchEnabled=false, userBank=false) {

    Is the online MPU_6050.js not formatted correctly to be used as a local module? Do I need to modify it, or change settings so I can load it in my project?

  • That's an issue with default parameter values. Online, the actual code uploaded by the IDE is the minified one but that doesn't have the default parameter value.

    As a workaround, change the MPU6050.prototype.setMemoryBank = function(bank, prefetchEnabled=false, userBank=false) { line to MPU6050.prototype.setMemoryBank = function(bank, prefetchEnabled, userBank) {


Avatar for AkosLukacs @AkosLukacs started