Using terminal to display motor position

I have this short code over here which I want to use to display a motor’s position to the terminal.

void printPos()
{
  while(true)
  {
    printf("leftFront.position(degrees)\n");
    wait(1,seconds);
  }
}
int main() 
{
  vexcodeInit();
  printPos();
}

Of course, this just writes leftFront.position(degrees) in the terminal every second. However, when I try typing

void printPos()
{
  while(true)
  {
    printf(leftFront.position(degrees));
    wait(1,seconds);
  }
}

It gives me an error on printf, saying [clang] No matching function to call to ‘printf’.
tldr, how can I use the terminal to display my motor’s position?

Try
printf(“Left front position: %f”, leftFront.position(degrees));

Not sure if this will work but you can also try print();

2 Likes

Wow, I wasn’t expecting a solution this quick! Thanks! This is what worked:

void printPos()
{
  while(true)
  {
    printf("Left Front Position: %f\n", leftFront.position(degrees));
    task::sleep(1000);
  }
}
1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.