Avatar for Mijunior

Mijunior

Member since May 2019 • Last active May 2019
  • 1 conversations
  • 1 comments

Most recent activity

  • in JavaScript
    Avatar for Mijunior

    I need a program that reads the output of a function generator, between 10 and 20kHz, I already know that javascript is a bit slow making it difficult to acquire the data, I already tried to use setWatch:

    var t1 = 0;
    var t2 =0;
    var period = 0;
    var flag = 0;
    
     setWatch(function(x){
     if (flag ===1)
      {
        t2 = x.time;
        periodo = t2 - t1;
        console.log(1/period);
        flag = 0;
      }  
    
       
    t1 = x.time;
    flag =1;
    
    }, A5 , {repeat:true ,  edge:'rising', debounce : 0.5});
    

    however I am not having satisfactory values. I was advised to use the STM32F4 hardware (http://www.espruino.com/STM32+Peripheral­s), but I do not know a way to do this because I'm new to the language.

Actions