Last active
June 19, 2020 23:12
-
-
Save Cat-Ion/a7a843bd14e45bc814f6895506486994 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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