-
• #2
Sat 2019.11.16
Hi @Ptitonio,
'I tried other module successfully'
Which module did you have success with?
I just checked the sample script:and it appears there is no binding of the pins for I2C to the MPU6050 using the connect() function. Is all the code actually provided in #1?
Also, the pin labeling L#1 scl,sda needs another look as the pin numbers are different between devices:for instance
http://www.espruino.com/Pico
Formatting help suggestion: It appears the reason for the block within the three backticks is not displaying correctly, is that this line 'TypeError: Cannot read property 'length'' needs to start on the next line following the backticks. Both opening and closing backtick group needs to be on its own line. -
• #3
Thank you Robin for your response.
Good test with the HR-SR04 module :
https://www.espruino.com/HC-SR04Bad test with MPU6050 module :
https://www.espruino.com/MPU6050I did tests on PICO and ESPRUINOWIFI with the same problem.
(screenshot of tests with ESPRUINOWIFI). -
• #4
screenshots...
2 Attachments
-
• #5
Has
dump()
been tried to look for 'undefined' vars? (e.g. is code module loading)or try
mpu
Another idea to wrap the code snippet in a try/catch code block to see if errors are occurring that are bubbling up and not caught.
Take a peek at the WebIDE console output: (the end of the listing)WebIDE >> Settings >> Console
It's possible, but a bit unlikely that upgrading to 2v04 might resolve. (not there yet)
Was it noticed that the modules require different operational voltages?SCL SDA swapped?
Solid grounding between the Espruino device and the module?
-
• #6
Turn off minification. The error on the first screenshot points to
prefetchenabled=false
in a function signature.
What version of the IDE you have? I thought the latest IDE can minify all of ES6. -
• #7
Here's the dump()
dump() var mpu = undefined; I2C1.setup({"scl":B6,"sda":B7}); pinMode(B6, "af_opendrain", true); pinMode(B7, "af_opendrain", true);
=undefinedmpu
=undefinedI put the minification off (the second red error message disappears).
I controlled the wiring well.
I made tests with firmware 1.97, 2.00, 2.02 & 2.04, without success.
Attached a copy of the console
1 Attachment
-
• #8
Hi AkosLukacs,
Turn off minification only deletes the message :
TypeError: Cannot read property 'length' of undefined
I have Web Ide 0.72.1
I have also a Espruino IDE Native version 0.69.0 for my MDBT42Q Bluetooth Module.
I made tests with it on Pico this morning, and COOL ! It works fine ?There are some issues with Web Ide 0.72.1
-
• #9
Ah, ok, another problem is that the MPU6050 is rather big, there is another recent thread, and
Gordon's comment solved the size problem in the other thread.Oh, and update the Native Ide, might help.
-
• #10
I installed Espruino IDE Native version 0.72.1 and it works well with the MPU6050 module.
-
• #11
Mon 2019.11.18
Glad you got it working!
A bit of confusion in #8, so the Pico is working with Native 0.69.0 then?
Was it the uploading of modules as functions? (ref Gordon's comment link in #9)
... or, ...
upgrading to IDE Native version 0.72.1? (as indicated in #10)
'There are some issues with Web Ide 0.72.1'
What specifically is observed with 'some issues'?
-
• #12
Yes Pico (and EspruinoWifi) works when I use IDE Native 0.69.0 (and 0.72.1) to transfert code.
Its just longer , about 1 mn forthis code :I2C3.setup({scl:A8, sda:B4, bitrate:100000}); const MPU = require("MPU6050").connect(I2C3); // 2nd parameter is the fifoRate. The DMP output frequency = 200Hz / (1 + fifoRate) const DMP = require("MPU6050_DMP").create(MPU, 3); function pidLoop(args) { var data = DMP.getData(); if(data !== undefined) console.log(DMP.getYawPitchRoll(data)); } setWatch(pidLoop, B5, { repeat:true, edge:'rising' });
No I didn't use the option "Module uploaded as functions". The code is uploaded in RAM .
When I was doing tests with different IDE, I noticed some strange things. I'm going to synthesize all this in a new post.
-
• #13
Here is the result of my tests with 2 IDEs: WEB IDE 0.72.1 and Espruino Native IDE 0.72.1
I use the same hardware based on PICO, with the following code:I2C3.setup({scl:A8, sda:B4, bitrate:100000}); const MPU = require("MPU6050").connect(I2C3); // 2nd parameter is the fifoRate. The DMP output frequency = 200Hz / (1 + fifoRate) const DMP = require("MPU6050_DMP").create(MPU, 3); function pidLoop(args) { var data = DMP.getData(); if(data !== undefined) console.log(DMP.getYawPitchRoll(data)); } setWatch(pidLoop, B5, { repeat:true, edge:'rising' });
We see:
1 - WEB IDE without Minification
An error LOW_MEMORY2 - Espruino Native IDE without Minification
No error, Upload ok, working ok3 - WEB IDE with Minification (Esprima Offline)
"TypeError" errors on MPU6050 module but not on MPU6050_DM module whose size is 31561 bytes
A syntax error ...4 - Espruino Native IDE with Minification (Esprima Offline)
No error, Upload ok, the size of the module MPU6050_DM = 17182 bytes
Operation ok
It's strange the modules do not have the same size.
Apparently the 2 IDEs do not use the same modules. -
• #14
Screenshoots ...
4 Attachments
-
• #15
In your IDE's settings (the one with the error), is
communications -> Module extensions
set to.min.js|.js
? That's the default.If so the minified modules should already be loaded by default. The length of 31561 you're seeing would only be happening if the IDE was loading the unminified file. Is it possible you changed that setting, or have your own local copy of the module?
Also, when you mention
WEB IDE with Minification (Esprima Offline)
- is this the one from espruino.com/ide, or the Chrome Web store? Up to date versions of the IDE should use a newer version of Esprima which I'm pretty sure doesn't have theTypeError
issue -
• #16
Gordon ! We are a genie !
Indeed the setting of Chrome Web store IDE was :.js.|min.j
Yet I had control over the setting of both IDE.
I do not remember having modified this parameter on Chrome Web store IDE.
Now Both of IDE works fine.Thanks a lot
PS: WEB IDE = Chrome Web store IDE
Hello ,
when I save this code on my Pico or EspruiniWiFi :
the console return :
I tried other module successfully.
Is the MPU6050 module a problem?
Am I missing something?
Thank you for your help