You are reading a single comment by @allObjects and its replies. Click here to read the full conversation.
  • To my knowledge, the board has a user button - does it? You can use it with a bit of code and a watch w/ second hand to (roughly) figure out what - it at all - clocking has an impact.

    Set a repeating watch on the button with a callback that stores the time in an array. Then you take some times like taking lap times: press the button, watch your watch for 10 seconds, press the button again, an do that several times.

    After that, list the array in the console window and do some math...

    Copy following code into the edit area in the IDE and upload it to the board.

    var ts = [];
    setWatch(function(e){ts.push(e.time);},B­TN,{repeat:true,edge:"falling",debounce:­10});
    

    For the explanation of the code look take a look at:http://www.espruino.com/Reference#l__glo­bal_setWatch

    I kept the function as terse as possible to have minimal impact on time.

    For looking at the times captured enter the following in your console:

    console.log(ts);
    

    If there are not too many times in the array, it will list them all. Otherwise, use enter the following to get them all, each on a single line:

    ts.forEach(function(t){ console.log(t); });
    

    For more luxury or convenient math, add this snipped to the code initial code which you upload to the board.

    displayResults() {
    var i, t0 = 0, cnt = 0, sum = 0;
    ts.forEach(function(t){ 
      if (cnt > 0) {
        i = t - t0;
       sum += i;
        console.log(t, i); 
      } 
      t0 = t; cnt++; 
     });
     if (cnt > 0) {
       console.log("average of ", cnt, " x-second measurements: ", i / cnt);
     } 
    

    To show the results, enter displayResults() in the console.

    If you pressed the button 11 times - every ten seconds, you will get 10 values you can average... and if you do not get a value close to 10 (seconds), then you know that the clock has an impact. If there is an impact, you may calculate a correction coefficient sufficiently accurate... and if you want it more accurate, you can take it minute by minute, or even hour by hour and do the math... with error calculation (this will give you a calibrated correction coefficient).

    To repeat the process, just upload the code again, or enter ts = [] in the console to empty the time collector array.

    Btw, your numbers look odd to me, because they should have some relation to the clock frequency... but I'm sure @Gordon has a much better explanation than my empirical approach is based on.

About

Avatar for allObjects @allObjects started