The following code executes and prints a statement ~20 times a second.
while (1) {
TX(port, "j1");
usleep(30000);
printf("\nPosition:\t%s", (*RX(port)).data);
}
Rather than constant new lines, I wish to have a single line printed, with the string that follows Position:
updated as quickly as possible. To do so, I've replaced the new line with a carriage return:
while (1) {
TX(port, "j1");
usleep(30000);
printf("\rPosition:\t%s", (*RX(port)).data);
}
It is producing the exact format I want, but now I only get a print every ~6 seconds. Can anyone explain why and offer a solution?