• Yes, I imagine every 16ms is too quick, and likely the data is just getting buffered until you run out of memory.

    It's a difficult one - it is possible to actually look at the internals of the socket connection and see how much data there is in the buffer, but personally I'd say just back off a bit until you get something that works reliably. Obviously if you've got the buffer even at all full then that's data that is being delayed from being sent - so having slower data is better than having fast data that's out of date.

    Also - try sending the data as binary, or at the very least change the existing JSON so you sent a a field rather than acceleration and so on - which should reduce the amount of bytes that need to be sent.

    As for the pause, I don't know what to suggest - maybe blink an LED each time Espruino takes a reading so you can see if it's the Espruino or something else that's causing the delay. Espruino's GC is called very rarely, and is designed to be super-fast (it should be well under 2ms) so you shouldn't notice it at all.

About

Avatar for Gordon @Gordon started