• ... , it gives direct pointer to flash memory

    This is true, but w.buffer.set(wave); should then just copy that into the RAM buffer so the waveform should work.

    I just tried here and something odd does seem to be going on.

    If you do repeat:true then it does work. For instance this 'pulses' the LED:

    var w = new Waveform(256);
    for (var i=0;i<256;i++) w.buffer[i] = 128+Math.sin(i*Math.PI/128)*127;
    analogWrite(LED1, 0.5);
    w.on("finish", function(buf) {
    w.startOutput(LED1, 100, {repeat:true});

    But there's some odd flickering going on right at the start which makes me think maybe the start time is set wrong. I'll see if I can figure out what's up and get back to you


Avatar for Gordon @Gordon started