Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
5 years, 8 months ago.
mbed serial - print variable value
Board: FRM K64f
Trying to print a value of a variable.
heres code
Serial pc(USBTX, USBRX); int main () {
DynamixelClass my(57600, PTC17, PTC16);
int pos = my.readPosition(SERVO_ID);
pc.baud(57600);
pc.printf("H");
pc.printf(pos);
Error: Argument of type "int" is incompatible with parameter of type "const char *" in "main.cpp", Line: 12, Col: 16
1 Answer
5 years, 8 months ago.
correct is...
pc.printf("%d \n", pos);
http://www.cplusplus.com/reference/cstdio/printf/