Not working. It must be a reason for that ?
_____ _ | |_ ___ ___ _ ||___ ___ | |_ -| . | _| | | | | . | ||| || |_|||_|_| |_| http://espruino.com 1v50 Copyright 2014 G.Williams echo(0); X= 0 Y= 0 X= 0 Y= 0 X= 0 Y= 0 X= 0 Y= 0 X= 0 Y= 0 =undefined X= 0 Y= 0
_____ _ | |_ ___ ___ _ ||___ ___ | |_ -| . | _| | | | | . | ||| || |_|||_|_|
|_| http://espruino.com 1v50 Copyright 2014 G.Williams
echo(0); X= 0 Y= 0 X= 0 Y= 0 X= 0 Y= 0 X= 0 Y= 0 X= 0 Y= 0 =undefined X= 0 Y= 0
function onInit() { SPI1.setup({ sck: A5, miso: A6, mosi: A7 , cs: E3, int1: E0, int2:E1 } ); SPI1.send([0x20,0b01000111], E3); } var avrx=0.0, avry=0.0; function getAcc() { var accx = SPI1.send([0xA9,0], E3)[1]; var accy = SPI1.send([0xAB,0], E3)[1]; if (accx>127) accx-=256; if (accy>127) accy-=256; avrx = 0.1*accx + 0.9*avrx; avry = 0.1*accy + 0.9*avry; console.log("X= "+avrx+" Y= "+avry); } onInit(); var t = setInterval(getAcc, 10); // clearInterval(t);
@user6350 started
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.
Not working.
It must be a reason for that ?