• v1(a)
    0.030798
    0.030268
    0.030341
    0.03037
    0.030436
    0.030451
    0.030515
    0.030617
    0.03060900000
    0.030679
    0.03064899999
    0.030679
    0.03073700000
    0.030856
    0.030821
    0.030756
    0.030841
    0.030878
    0.03080600000
    0.03079500000
    0.03083700000
    0.030755
    0.030751
    0.030744
    0.03070499999
    0.030687

    v2(a)
    0.023461
    0.02335299999
    0.02293
    0.02335500000
    0.02342099999
    0.02307199999
    0.023368
    0.02320199999
    0.02309100000
    0.02331900000
    0.02320100000
    0.02319399999
    0.02319899999
    0.02302300000
    0.02329700000
    0.023054
    0.022922
    0.023505
    0.02313600000
    0.02292699999
    0.023507
    0.02306500000
    0.02308200000
    0.02353299999

    v2(b)
    0.03001599999
    0.030012
    0.03011499999
    0.03015499999
    0.03018
    0.03026499999
    0.03029300000
    0.03027200000
    0.030347
    0.03035300000
    0.03045099999
    0.030484
    0.03047499999
    0.03058799999
    0.03059
    0.03054
    0.03057
    0.030644
    0.03053399999
    0.03054
    0.030553
    0.030486

    v2(c)
    0.02292799999
    0.02256799999
    0.02212799999
    0.02253500000
    0.02267299999
    0.02225899999
    0.02259800000
    0.02252500000
    0.02243099999
    0.02248499999
    0.02235399999
    0.02252299999
    0.02236899999
    0.02222599999
    0.02252699999
    0.02229300000
    0.02217800000
    0.02258200000

    v2 variants needed some remediation on var t0, along with parens

    // V2b - flash an 8 LED neopixel array in a rainbow pattern
    var neo = require("neopixel");
    var led_count = 8;
    var neoPin = NodeMCU.D4;
    var rgb = new Uint8ClampedArray(led_count * 3);
    var len = rgb.length;
    var m = 127;
    var r = 0.1324*m;
    var g = 0.1654*m;
    var b = 0.1*m;
    var pos = 0;
    var t0;
    function getPattern() {
      pos++;
      for (var i=0; i<len;) {
        rgb[i++] = m + Math.sin((i+pos)*r);
        rgb[i++] = m + Math.sin((i+pos)*g);
        rgb[i++] = m + Math.sin((i+pos)*b);
      }
      console.log(getTime() - t0);
      return rgb;
    }
    function bow() {
      t0 = getTime();
      neo.write(neoPin, getPattern());
    }
    function onInit() {
      setInterval(bow,200); // may need to change to allow console to write
    }
    setTimeout(onInit, 1000);
    
About

Avatar for user85573 @user85573 started