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.

Thanks in advance.

Is this the first time you’ve used an imp?

You probably already saw this?


Sure, i did!
Are you able to identify the method that returns the number of bytes received (present) in the buffer?

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 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.

You can also empty the buffer in one go with uart.readstring() or readblob().