Also in searchduration you're clearing a timeout which won't exist (because it will have just timed out... That is probably what is giving you your timeout errors...
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.
Also in searchduration you're clearing a timeout which won't exist (because it will have just timed out... That is probably what is giving you your timeout errors...