but on the OLED I still see "Connected" and the temp is changing every 5 seconds. I guess it's because the Interval function that is still running
Yes... so in BLE_Connect you call setInterval but you never clear that interval.
Try:
var updateInterval;
function BLE_Connect(){
updateInterval = setInterval(function() {
....
}
function BLE_Disconnect(){
if (updateInterval) clearInterval(updateInterval);
updateInterval=undefined;
...
}
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.
Yes... so in
BLE_Connect
you callsetInterval
but you never clear that interval.Try: