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.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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:
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.