Looking at the tilt library it seems to be using INT1.
The setWatch(button) isn't clear on which interrupt it is using.
Each of these two separate tests work independently but when I combine them they must conflict.
var pressCount = 0; var tiltCount = 0; var batt = 0; var redLEDOn = false; var greenLEDOn = false; var blueLEDOn = false; function swapBlue() { blueLEDOn = !blueLEDOn; LED3.write(blueLEDOn); } function swapGreen() { greenLEDOn = !greenLEDOn; LED2.write(greenLEDOn); } # Tilt detection works by itself, fails when combined with Button watching. require("puckjsv2-accel-tilt").on(); Puck.on('accel',function() { batt = Puck.getBatteryPercentage(); tiltCount++; swapGreen(); NRF.setAdvertising({ 0x1821 : [tiltCount], 0x180f : batt, }); } ); # Button watching works by itself but fails when combined with tilt detection. setWatch(function() { batt = Puck.getBatteryPercentage(); pressCount++; swapBlue(); NRF.setAdvertising({ 0x1812 : [pressCount], 0x180f : batt, }); }, BTN, { edge:"rising", repeat:true, debounce:50 });
@HeneryH_(Henery_Hawk) 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.
Looking at the tilt library it seems to be using INT1.
The setWatch(button) isn't clear on which interrupt it is using.
Each of these two separate tests work independently but when I combine them they must conflict.