Hello all,
does anyone know if there is an imp uart method such as serial.available() in arduino or particle?
I’m using an imp to receive frames from an xbee and i would like to know if there are any bytes received on RX imp pin.
There is no method to determine the number of bytes waiting in the buffer because typically you register a callback function which will be called automatically when there are bytes for you to read, ie. you don’t have to poll the buffer to see if there are any bytes there - impOS does this for you.
The first example in the uart.read() documentation shows how you set this up: you register a function, arduinoData(), which is called when there are bytes in the buffer. arduinoData() then reads them in until the buffer is empty. At this point you can either count and store these bytes for later, or process them there and then.