I updated my puck to 1v95.153 and uploaded this code:
function fq(sec){
var cSec=0, sBuff=new Uint8Array(sec);
var w=new Waveform(512,{doubleBuffer:true,bits:8});
var a=new Uint16Array(512);
w.on("buffer", function(buf) {
a.set(buf);
E.FFT(a);
var m=0,n=-1;
for (var i=150;i<250;i++)if(a[i]>n)n=a[m=i];
sBuff[cSec]=m.toFixed(0);
console.log(sBuff[cSec]+"Hz @ "+n);
cSec++;
if (cSec >= sec) {
w.stop();
var v=E.sum(sBuff)/sec;
var rKey=new Date(Date.now()).toString();
console.log(rKey,v);
}
});
w.startInput(D2,512,{repeat:true});
}
which worked before.
When you call fq(3) for example, the puck got reset. The problem comes from E.FFT(a);
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.
Hi @Gordon,
I updated my puck to 1v95.153 and uploaded this code:
which worked before.
When you call fq(3) for example, the puck got reset. The problem comes from E.FFT(a);
Thank you.