Avatar for allObjects

allObjects

Member since Jul 2014 • Last active May 2017

Very excited about Espruino and even more so about Pico!

Most recent activity

  • in Pico / Wifi / Original Espruino
    Avatar for allObjects

    @Wilberforce... may be left and right got a bit mixed up... did it...

    Things entered on the left side are JavaScript expressions / statements that are immediately executed. Therefore, if you enter something like var mod = require("moduleName");, Espruino tries to executed that, which means: get the module from the Espruino (memory)'s Modules cache. Since it is not there, Espruino tries to look for it on a mounted SD card. If the card is not mounted, 'mount error' is printed and subsequently the 'module not found error'.

    If you really want to use the left side to load a module into the cache, you have to do it differently - as documented - in Modules.addCached("moduleName","moduleSo­urceCode"); (id and moduleName are the interchangeable).

    If you track what the IDE does when uploading code with a require("moduleName");, it does exactly above: The IDE grabs the file from espruino.com/modules/moduleName.­min.js as text and executes Modules.addCached("moduleName","moduleSo­urceCodeAsReadFromTheFile.min.js");.

    This though has limitations, because it does not handle nested require(...): if a module source code that you push into the cache in the left side of the IDE, you also have to that recursively for all the included require(...).

    If entered in the right side - editor side - and uploaded using the upload button - all this is taken care of.

    Now there may be the situation that modules are in deed on an SD card and the SD card is mounted on the Espruino board. If you then want to take advantage of that while still uploading code from the Editor side, you would stick the moduleName as string into a variable and then use the variable in the require expression:

    var moduleNameVar = "moduleName";
    var mod = require(moduleNameVar);
    

    Doing it this way, the upload process does not find a literally required module (finding the exact character sequence require("...") and therefore not jump into action a retrieve the module from the Web / or local project/modules/ sandbox folder and upload it to the Modules cache.

    When it then comes to execution, the module is not found in the Modules cache but it would hen find it on the mounted SD card (if the card is mounted...).

    (PS: there is now also an option that modules are stored as functions in Espruino cache... I do though not know how it could be done using the left side... may be the reference doc is not updated yet...).

  • in Interfacing
    Avatar for allObjects

    Why would you use a .connect() function / method to create a Rodrigues instance?

    I know hat this pattern is typical for connecting devices. But in this case, it is just a transformer, isn't?

    To return a constructor function in a require, just set the exported object to it: exports = Rodrigues;.

    If you want to stick with the pattern, you can return exports.getInstance = function() { return new Rodrigues(); } to provide a self documenting function.

  • in Pico / Wifi / Original Espruino
    Avatar for allObjects

    It is not clear where you enter this. It is expected to be in the editor / right hand pane of the Web IDE and then uploaded.

    When you are connected to the Web / internet and do the upload to the Espruino board, your code is first parsed for modules required with require("..."). The modules are pulled from espruino.com/modules/ folder, for example -
    in this case - either as EspruinoWiFi.js or EspruinoWiFi.min.js, uploaded to the Espruino board and stored in the Modules cache on Espruino board. After that, your code is uploaded. When it comes to execution of your code, require(...) will find the requested modules in the Modules cache and load/use them. If it cannot find them in the Modules cache, it tries to find a mounted SD card and looks for it there. If no card is mounted, the error message you see is what you get.

  • in General
    Avatar for allObjects

    There may be many things to be factored into your decision... price is one, anther one is what is how you power your devices, yet another one is your wifi infrastructure.

    esp32 - Espruino on ESP32 is a multi-core (duo core) processor and has also more memory resources. About how far the port of Espruino - that includes all the support incl HTTPS - has been achieved, you have to track down the conversations in the forum... I know that @Wilberforce, @JumJum, @Kolban (and others) have worked on its guts, and I have nowhere read that SSL would not be supported. From conversation Writing an SSL HTTPS web server ... I read that connecting with https to a server in the net is there, but not running a https listening server on ESP32.

    Looking up some more info about SLL and ESP8266, I came across this nice youtube

    and follow-up presentation. It talks about the space issue creating functions involved in SSL communication. Going to a single, defined server gives some relieve, and may be an option to go with less resource...

  • in General
    Avatar for allObjects

    ...there you go, thanks @Wilberforce...

    @AlessioBacin, just get a Espruino board that has a real ARM3 or 4 on it and use your ESP12E as plain wifi stack device. Talk to it with serial as supported in any Espruino and this way you get your https connection and programming in JavaScript.

    'Alternative' is using LUA on the ESP12E... but you could stick to Arduino then...

  • in Interfacing
    Avatar for allObjects

    ...I expected you to put the sensor onto the stirling engine fly wheel... a centered / balanced puck and sensor would work to measure the RPM. ;-)

  • in General
    Avatar for allObjects

    ESP12E is just an ESP8266 and you may run out of memory because the ESP code and the Espruino w/ application fight for the same RAM... And that's not the only issue you will run into, because ESP code has priority and may mess up your app running in Espruino JS. One processor is just not good enough to handle all at the same time, especially since ESP code behaves like bit banger in communication respects.

    Running your app on a native Espruino board and using the ESP for wifi - as Espruino-Wifi does and any Espruino boartd with any ESP8266 board do - gives you enough power and independence for the app and the wifi communication/

    I assume you consulted Espruino on ESP8266 and the related forum conversations that will get you started with Espruino on your current device.

  • in General
    Avatar for allObjects

    ...it's all there... w/ Espruino-Wifi, for example, or any other Espruino plus a wifi breakout board...

  • in Interfacing
    Avatar for allObjects

    I know that there is xon/xoff flow control, but did not see any option that you could specify pins for HW flow control - see reference Serial_setup

  • in Interfacing
    Avatar for allObjects

    ...since it is a @Gordon/node.js-classical-module-setup, global MPU6050 ('constructor') function is not exposed... in other words, your code is ok to use MPU6050 for the module (singleton) object returned by require(). The module object returned knows only .connect() - a function that then indeed invokes encapsulated/hidden MPU6050(...){...} with new and returns an "MPU6050" instance.

    I do not know the inner workings/details of the driver and the MPU650's behavior, but I would put the .connect(...) and setInterval(...) into an onInit() {...} function to have it also working when saved, disconnected and re-powered, because the - as said - the .connect...() creates the instance and calls initializations within the MPU6050 which for sure will not be saved within Espruino.

    Not soldered pins is not a good idea... (there are special pins that need no soldering but they are hard to use and often break the (thinner) breakout boards...).

    I may understand why you do not want to solder pins the standard way... Depending on how the pins are held in their plastic, you may just solder them in 'the other way round' without pushing them all the way in the the plastic touches the board. After solidly soldering them in, you can remove the plastic by preying gently multiple times on multiple locations. If you are then done with prototyping and you want to solder wires directly (or other final connections), you can take off pin by pin easily.

Actions