add Arduino example

This commit is contained in:
Alexander Popov 2023-07-30 11:10:19 +03:00
parent 82e034fdd0
commit 3ff907994a
Signed by: iiiypuk
GPG Key ID: E47FE0AB36CD5ED6
5 changed files with 31 additions and 1 deletions

View File

@ -2,5 +2,5 @@
indent_style = space
indent_size = 4
[*.c]
[{*.c,*.ino}]
indent_size = 2

1
~/C/libserialport/Board/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
3party/

View File

@ -0,0 +1,24 @@
/*
Author: Alexander Popov
License: Unlicense
*/
#include "3party/AsyncStream.h"
AsyncStream<50> serial(&Serial, '\n');
void setup() {
Serial.begin(9600);
}
void loop() {
if (strcmp(serial.buf, "ping") == 0) {
Serial.println("PONG");
}
Serial.println("ooooo");
// delay(1000);
Serial.println("zzzz");
// delay(1000);
Serial.println("xxx");
// delay(1000);
}

View File

@ -0,0 +1,3 @@
Download `AsyncStream.h` from
https://github.com/GyverLibs/AsyncStream
and drop in to `3party` folder.

View File

@ -14,3 +14,5 @@ export LIBRARY_PATH=<path/to/libserialport/.libs>
gcc -static -Wall -O3 -o <output_filename> <file.c> -lserialport
```
Arduino example project store in `Board` folder.