This commit is contained in:
Dmitry Borisenko
2021-12-22 14:09:50 +01:00
parent 5e9b15e7de
commit 24a9d55ea0
195 changed files with 15629 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
// StreamUtils - github.com/bblanchon/ArduinoStreamUtils
// Copyright Benoit Blanchon 2019-2021
// MIT License
//
// This example shows how to buffer the read operations of a stream.
//
// Like "echo," it reads from the serial port and prints back the same thing.
// What's interesting with this program is that it reads the input in chunks of
// 64 bytes, even if it seems to read them one by one.
#include <StreamUtils.h>
ReadBufferingStream bufferedSerial{Serial, 64};
void setup() {
// Initialize serial port
Serial.begin(9600);
while (!Serial)
continue;
}
void loop() {
// Even if it looks like the bytes are extracted one by one, they are actually
// read by chunks of 64 bytes and placed in a buffer.
while (bufferedSerial.available()) {
Serial.write(bufferedSerial.read());
}
}
/*****************************************************
* *
* Love this project? *
* Star it on GitHub! *
* *
* .,,. *
* ,,:1. *
* ,.,:;1 *
* .,,,::;: *
* ,,,,::;;. *
* .,,,:::;;; *
* .....,,,,...,.,,,,,,:::,,,,,,,,,,,,, *
* ,,,,,,,,,,,:,...,,,,,,:::,,,,:::;;;11l *
* .;::::::::,,,,,,,,,,:::::,,::;;;1lt *
* .;;;:::,,,,,,,,::::::;:::;;1t: *
* :;;:,,,,,,::::::;;;;;;l1 *
* ,,,,:::::::;;;;;;l *
* .,,,,::::;;;;;;;:::: *
* ,,,,,:::;;;;;::,:::1 *
* ,,,,,::;;;t1:,,:::::;l *
* .,,,,:;;ll ;::::::;;, *
* ,,,:;ll. .1:::;;l *
* .,:lt, .1;;l: *
* *
* https://github.com/bblanchon/ArduinoStreamUtils *
* *
*****************************************************/