Skip to content

Instantly share code, notes, and snippets.

@Cat-Ion
Last active June 19, 2020 23:12
Show Gist options
  • Save Cat-Ion/a7a843bd14e45bc814f6895506486994 to your computer and use it in GitHub Desktop.
Save Cat-Ion/a7a843bd14e45bc814f6895506486994 to your computer and use it in GitHub Desktop.
BEGIN{n=0;}
{
/* Grab six bytes */
while(n != 6) {
/* The first byte is always A8, so wait for that */
while(n == 0 && $2 != "A8")
getline;
/* Only take data from the UART */
if(/^uart-1:/) {
/* Save it to an array */
d[n] = $2;
n++;
/* Next line */
getline;
}
};
/* Print time and all the data */
printf("%s ", strftime("%Y-%m-%d %H:%M:%S"));
for(i = 0; i < n; i++) {
printf(" %s", d[i]);
}
printf("\n");
fflush();
/* Reset for next cycle */
n = 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment