The basic while loop structure is as follows:-While a read timeout has NOT occurred -wait for an available byte to be received Once an available byte has been received: -While a timeout has NOT occured -Check for start flag [DLE] [STX] When the start flag has been received: -While a timeout has NOT occured AND end flag [DLE] [ETX] has not been received -Receive data and Unstuff data (replace all instances of [DLE] [DLE] with [DLE]) When the end flag has been received: -Use last two bytes of data as CRC16 and check data validity against this CRC value -IF data valid, return data. IF data invalid return -1IF a timeout occurs before any data is received return 0. IF timeout occurs during data read return -1.
May 5, 2013 - Repository updated with new version! Significantly reduced memory cost for Arduino (now usable on boards other than Due). Python program also improved.