• Hi guys,

    I need your help because I need execute a sync delay similar to Arduino function built-in. Like this:

    module.wait(5000); // this code must be stop the execution until the time is completed

    I tried with:

    Contents of module_file.js:

    exports.wait = (time) =>{
      var i = 0;
      while(i < time * 10) {  i++; }

    I tried also with:

    const startPoint = new Date().getTime()
      while (new Date().getTime() - startPoint <= ms) {/* wait */}

    And the result when tried to call more that 3000 ms is a dump and reset with this log:

    ets Jan 8 2013,rst cause:2, boot mode:(3,6)
    load 0x40100000, len 2408, room 16
    tail 8
    chksum 0xe5
    load 0x3ffe8000, len 776, room 0
    tail 8
    chksum 0x84
    load 0x3ffe8310, len 632, room 0
    tail 8
    chksum 0xd8
    csum 0xd8
    2nd boot version : 1.6
    SPI Speed : 80MHz
    SPI Mode : DIO
    SPI Flash Size & Map: 32Mbit(512KB+512KB)
    jump to run user1 @ 1000
    âìoärûo|ì dldl`c²ð |rdoàoã l odûþLoading 4948 bytes from flash...

    What's happened? I'm very stressed with this.

    Thanks and XoXo,

  • Wed 2019.02.06

    'What's happened? I'm very stressed with this'

    Deep breath, mantra tone ummmmmmmmm, another coffee, less coffee?

    It might be that the Javascript language is the culprit. I find that this resource is a good go-to when ideas are needed:


    I believe that Option #2 in post #2 is what you are after.

    Should that darn servo just not want to cooperate, please post that code block using the 'code' button slightly above the edit window. You won't be able to scare us with what you have so far so no need to stress about that. Converting from C to Javascript does take a knack to get the hang of, but once one gets going, it is rather easy.


Avatar for user97622 @user97622 started