You are reading a single comment by @Robin and its replies. Click here to read the full conversation.
  • if you try this simple example

    let p = 0;
    
    function onInit() {
      setInterval(() => {
        //allume la led 50ms
        digitalPulse(LED2, 1, 20);
        console.log((Math.sin(p)+1)/2);//, (Math.cos(p)+1)/2, tab.BUTTONS.NONE);
        p += 0.02;
      },
      50);
    }
    USB.setConsole();
    

    and upload, i receive :

    Uncaught SyntaxError: Got ';' expected ','
    at line 1 col 79
    ...((Math.sin(p)+1)/2),p+=0.02;,50);

    in function called from system

  • Thr 2020.03.05

    Hi @@Mrbbp I just tried the snippet in post #1, commenting out L12, running on a MDBT42Q breakout board and get the following:

     2v03 (c) 2018 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    >
    >onInit()
    =undefined
    0.5
    0.50999933334
    0.51999466709
    0.52998200323
    0.53995734698
    0.54991670832
    0.55985610364
    0.56977155732
    0.57965910330
    0.58951478671
    0.59933466539
    0.60911481154
    0.61885131321
    0.62854027594
    0.63817782428
    0.64776010333
    0.65728328030
    0.66674354607
    



    First, try commenting out L6 and re-run the test. If successful, then it is most likely the first argument's value for the 'pin' parameter.

    http://www.espruino.com/Reference#l__glo­bal_digitalPulse



    Second, the Uncaught SyntaxError output is parsed different than L7    Are we sure the Exact code block is being supplied, or was this a trimmed down version for demonstration?

    console.log((Math.sin(p)+1)/2);//, (Math.cos(p)+1)/2, tab.BUTTONS.NONE);
    ...((Math.sin(p)+1)/2),p+=0.02;,50);

    comma vs semi-colon allowing the comment to be treated as code



    Third, Please post the results of process.env so that we may understand the environment better.



    Full set of reference links to check out at:

    Writing an effective forum post
    http://forum.espruino.com/conversations/­335009/

About

Avatar for Robin @Robin started