This example shows how to use serial input over a port shared with the serial allocator.
#include <Arduino.h>
const uint32_t poolSize = 1024l * 32l;
void setup()
{
while (!Serial)
;
valloc.start();
}
void loop()
{
if (valloc.input.availableAtLeast() > 0)
{
int bytes = valloc.input.available();
Serial.print("read single byte: "); Serial.println(valloc.input.read());
--bytes;
if (bytes > 0)
{
char buffer[128];
bytes = max(bytes, 127);
const int readbytes = valloc.input.readBytes(buffer, bytes);
buffer[readbytes] = 0;
Serial.print("read string: "); Serial.println(buffer);
}
}
}