-
-
Save suru-dissanaike/f241ce9318a3d5ad7f9d777069d85154 to your computer and use it in GitHub Desktop.
BLE pushbutton with counter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var blueLEDOn = false; | |
var pushbuttonCounter = 0; | |
setInterval(function () { | |
blueLEDOn = !blueLEDOn; | |
LED3.write(blueLEDOn); | |
}, 1000); | |
NRF.setAdvertising({}, { manufacturer: 0x0590, manufacturerData: [pushbuttonCounter] }); | |
setWatch(function () { | |
pushbuttonCounter++; | |
if (pushbuttonCounter > 255) | |
pushbuttonCounter = 0; | |
NRF.setAdvertising({}, { manufacturer: 0x0590, manufacturerData: [pushbuttonCounter] }); | |
}, BTN, { edge: "rising", repeat: 1, debounce: 20 }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment