• The subject says it all - I get different light sensor readings depending on how frequently I call Puck.light().

    These are measured in constant lighting conditions:

    Average light at 0.5 Hz: 0.60877327967
    Average light at 1 Hz: 0.61237373737
    Average light at 10 Hz: 0.34283262310
    Average light at 25 Hz: 0.39304174558
    Average light at 100 Hz: 0.46682646780
    Average light at 1000 Hz: 0.50218986742
    

    The values seem to be roughly:

    • at a maximum when below 1 Hz,
    • at a minimum at ~10 Hz,
    • rising (up to some limit) when above 10 Hz.

    Using the following code:

    ITER=10;
    var experiment = function(dly) {
      var arr = [];
      var f = function(c) {
        arr[c] = Puck.light();
        if (c<ITER) setTimeout(f,dly,c+1);
      };
      setTimeout(()=>console.log("Average light at " + Math.round(100000/dly)/100+ " Hz: "+E.sum(arr)/arr.length),(ITER)*dly+50);­
      f(0);
    };
    
    experiment(100); // set the argument to number of milliseconds between readings
    

    Any ideas why this is happening?

About

Avatar for Ron @Ron started