Avatar for user90787

user90787

Member since Jun 2018 • Last active Jul 2018
  • 2 conversations
  • 4 comments

Most recent activity

    • 17 comments
    • 5,736 views
  • in Interfacing
    Avatar for user90787

    Sounds interesting - any references I could take a look at to wrap my head around this concept?

    • 2 comments
    • 1,852 views
  • in Interfacing
    Avatar for user90787

    Actually, just ran a test, the framerate is dropping to 12fps when the code is executed - otherwise it runs at 33fps.

    
    //hacks to get TWEEN to work
    var window = {};
    window.setTimeout = setTimeout;
    
    var TWEEN = require("Tween");
    var neopixel = require("neopixel");
    
    //hacks to get TWEEN to work
    process.hrtime = null;
    TWEEN.now = Date.now;
    
    var lastLoop = new Date();
    
    function animate(time) {
      
        var thisLoop = new Date();
        var fps = 1000 / (thisLoop - lastLoop);
        console.log(fps);
        lastLoop = thisLoop;
      
    	TWEEN.update(time);
    }
    setInterval(animate, 1);
    
    function run() {
      
      var leds = 24;
      var arr = new Uint8ClampedArray(leds*3);
      var n = 0;
    
      var coords = { x: 0, y: 0 }; // Start at (0, 0)
      var tween = new TWEEN.Tween(coords)
          .to({ x: 255, y: 2000 }, 1000)
        .easing(TWEEN.Easing.Quadratic.Out)
          .onUpdate(function() {
            var r = Math.round(coords.x);
            n = 0;
            for(var a = 0 ; a < arr.length ; a++) {
               arr[n++] = (Math.random() * 255) * 0.25; 
            }
            
            neopixel.write(D30, arr);
          })
          .start();
    
    }
    
  • in Interfacing
    Avatar for user90787

    I've got a 24 Led ring which I'm able to control successfully from Puck.js. The FPS, however, is a little 'meh'. I am using setInterval at an interval of 1 milli (just to see if that speeds it up any) and it looks like it's running around 20-25-ish FPS. Also, I don't have anything logging to the console (I noticed that slowed things down some).

    Is there any way to either increase the speed at which the pixels refresh over SPI or is there a better method than setInterval to provide a little more FPS to the leds?

    Thanks!

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user90787

    I read on the GSAP (http://www.greensock.com) forum that a user was able to install TweenLite onto their Espruino. I tried and it looks like I'm getting an out of memory issue. The size of the library is 28kb. Am I missing something?

    Thanks!

    • JoHN
Actions