mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 14:42:18 +03:00
Fixed Ultrasonic, Start uart
This commit is contained in:
27
src/SoftUART.cpp
Normal file
27
src/SoftUART.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "SoftUART.h"
|
||||
|
||||
SoftwareSerial* myUART{ nullptr };
|
||||
|
||||
void uartInit() {
|
||||
if (!myUART) {
|
||||
myUART = new SoftwareSerial(4, 5);
|
||||
}
|
||||
}
|
||||
|
||||
void uartHandle() {
|
||||
static String incStr;
|
||||
if (myUART->available()) {
|
||||
char inc;
|
||||
inc = myUART->read();
|
||||
incStr += inc;
|
||||
if (inc == 0x0A) {
|
||||
parse(incStr);
|
||||
incStr = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void parse(String& incStr) {
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user