I have a problem that when connecting two Pucks together using BLE, there seems to be some sort of timeout going on which I did not program. I am using 1v91.
I have a central and a peripheral Puck. Here is the code for the peripheral, which is pretty vanilla:
Again, nothing special. So when I first press the button on the central, it will connect to the peripheral and write the value. The peripheral will shortly blink green. Connecting of course takes a while, but subsequent writes will be fast. So far so good.
The problem is that after letting the Pucks rest for a while, the write will fail. Then the catch will come into play and reconnect. So there seems to be some kind of inactivity timeout somewhere. I did not find any documentation for that or any hint how I can avoid that. Any ideas?
The question is if there is a better way to send integers (preferably not just 8 bits) than sending them as a character and reconverting to an integer? Also, the way I handle the !g_characteristic case feels pretty clumsy. Any better idea on how to handle that? Generally, any hint on how to program the central more elegant is welcome.
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,
I have a problem that when connecting two Pucks together using BLE, there seems to be some sort of timeout going on which I did not program. I am using 1v91.
I have a central and a peripheral Puck. Here is the code for the peripheral, which is pretty vanilla:
Here is the code for the central:
Again, nothing special. So when I first press the button on the central, it will connect to the peripheral and write the value. The peripheral will shortly blink green. Connecting of course takes a while, but subsequent writes will be fast. So far so good.
The problem is that after letting the Pucks rest for a while, the write will fail. Then the catch will come into play and reconnect. So there seems to be some kind of inactivity timeout somewhere. I did not find any documentation for that or any hint how I can avoid that. Any ideas?
The question is if there is a better way to send integers (preferably not just 8 bits) than sending them as a character and reconverting to an integer? Also, the way I handle the !g_characteristic case feels pretty clumsy. Any better idea on how to handle that? Generally, any hint on how to program the central more elegant is welcome.
Thanks!