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.
9 years, 2 months ago.
How to pc.print a variable's value in Tera Term software tools on display???
/*What is the function to pc.printf() various input parameters show???I'm a beginner */
- include "mbed.h"
DigitalOut myled(LED2); Serial pc(USBTX,USBRX); int main() { while(1) { unsigned i; myled = 0; pc.printf("hello world ");This can be printed on the terminal with Tera Term software tools(hello world)
/* I want to print on the terminal output variable (I) value but it doesnot work. */ /* for(i = 0; i < 10; i++) { printf("%d\n", i ); }
- /
wait(1); myled = 1; wait(1); } }
How to use the function of the pc.printf () to print out the value of a variable?Does anyone know? I will thank you very much for your help
1 Answer
9 years, 2 months ago.
<<CODE>> DigitalOut myled(LED2); Serial pc(USBTX,USBRX); int main() { while(1) { unsigned i; myled = 0; pc.printf("hello world "); for(i = 0; i < 10; i++) pc.printf("%d\n", i ); <-- use pc before printf to display it through terraterm ! .... wait(1); myled = 1; wait(1); } } <</CODE>>
and please use "<<code>> your code <</code>>
" to make sources more readable...