SafeString  4.1.27
SafeString is a safe, robust and debuggable replacement for string processing in Arduino
BufferedInput.h File Reference
#include <Print.h>
#include <Printable.h>
#include "SafeString.h"
#include "SafeStringNameSpaceStart.h"
#include "SafeStringNameSpaceEnd.h"

Go to the source code of this file.

Classes

class  BufferedInput
 To create a BufferedInput use the macro createBufferedInput see the detailed description. More...
 

Macros

#define createBufferedInput(name, size)   uint8_t name ## _INPUT_BUFFER[(size)]; BufferedInput name(sizeof(name ## _INPUT_BUFFER),name ## _INPUT_BUFFER);
 BufferedInput.h by Matthew Ford (c)2020 Forward Computing and Control Pty. More...
 

Macro Definition Documentation

◆ createBufferedInput

#define createBufferedInput (   name,
  size 
)    uint8_t name ## _INPUT_BUFFER[(size)]; BufferedInput name(sizeof(name ## _INPUT_BUFFER),name ## _INPUT_BUFFER);

BufferedInput.h by Matthew Ford (c)2020 Forward Computing and Control Pty.

Ltd. This code is not warranted to be fit for any purpose. You may only use it at your own risk. This code may be freely used for both private and commercial use. Provide this copyright is maintained. Usage: modes DROP_IF_FULL or DROP_UNTIL_EMPTY or BLOCK_IF_FULL. BLOCK_IF_FULL will delay loop() when buffer fills up createBufferedOutput( output, 64, DROP_IF_FULL); // buffered out called output with buffer size 64 and mode drop chars if buffer full OR createBufferedOutput( output, 64, DROP_IF_FULL, false); // for partial output of print(...)

Then in setup() output.connect(Serial,9600); // connect the buffered output to Serial releasing bytes at 9600 baud.

Then in loop() use output instead of Serial e.g. void loop() { put this line at the top of the loop, must be called each loop to release the buffered bytes output.nextByteOut(); // send a byte to Serial if it is time i.e. release at 9600baud ... output.print(" this is the msg"); // print to output instead of Serial ... output.read(); // can also read from output, not buffered reads directly from Serial. ... }

Definition at line 44 of file BufferedInput.h.