29 lines
451 B
C++

#include "serial.h"
#include <string>
#include <iostream>
#include <string.h>
#include <chrono>
int main()
{
serial s;
if (!s.init("/dev/ttyACM0"))
{
return 1;
}
uint8_t buf[150] = {0};
s.sread((uint8_t *)buf, sizeof(buf));
while (true)
{
int read = s.sread((uint8_t *)buf, sizeof(buf));
buf[read] = '\0';
if ('{' == *(char *)&buf[0])
{
printf("%s\n", (char *)&buf[0]);
}
}
return 0; // success
};