Just to add - there's no onRead at the moment, and while it may be possible to get notified after a characteristic is read, I don't think you can easily do something that returns the value you want to send as a response (and if you did, you'd probably be very time-limited).
What I normally see devices do is:
host device subscribes to notifications on a characteristic
host device writes anything to another characteristic
when the reading/calculation is finished, the first characteristic is used to return the data
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.
Just to add - there's no
onRead
at the moment, and while it may be possible to get notified after a characteristic is read, I don't think you can easily do something that returns the value you want to send as a response (and if you did, you'd probably be very time-limited).What I normally see devices do is: