• Sat 2019.11.23

    Needs to be verified with an oscilloscope

    Repeatable

    Found this example that suggests two pins of the same prefix should work

    http://www.espruino.com/LM393#line=9,10

    http://www.espruino.com/Reference#l__glo­bal_analogWrite
    Doesn't indicate that only one instance of analogWrite() may exist

    I originally thought this to be the number suffix when using setWatch(),

    http://www.espruino.com/Reference#l__glo­bal_setWatch
    'Note: The STM32 chip (used in the Espruino Board and Pico) cannot watch two pins with the same number - eg A0 and B0.'

    but after eliminating unnecessary code, found to be repeatable on other pins also.


    // 0.001 sec or 1msec or 100Hz
    // A0 PWM out - 10% duty cycle hi
    
    function a0() {
      analogWrite( A0, 0.1, { freq : 100 } );
    }
    
    // 0.1 sec or 100msec or 1Hz
    // A5 PWM out - 10% duty cycle hi
    function a5() {
      analogWrite( A5, 0.1, { freq : 1 } );
    }
    

    Run a0() - See Orn D3 output

    reset(1)

    Run a5() - See Pur D7 output

    reset(1)

    Run a0()
    Run a5() - See duplicated output - should be different!!

    A0 Orn D3 is being assigned the last defined analogWrite() A5


    Also tried with combinations of A(n) and B(n) pins - repeatable there also.

    The comments at

    https://github.com/espruino/Espruino/blo­b/master/src/jswrap_io.c#L167

    imply multiple pins may be used.


    {
      "VERSION": "2v04",
      "GIT_COMMIT": "3956264e",
      "BOARD": "ESPRUINOWIFI",
      "FLASH": 524288, "RAM": 131072,
    



    Low priority (for me anyway) solution required as I am getting by with

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


    3 Attachments

    • A0at100Hz10msec.jpg
    • A5at1Hz100msec.jpg
    • A0at100Hz10msecA5at1Hz100msec.jpg
About

Avatar for Robin @Robin started