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.
Strange result with printf and pc.printf on Nucleo F411RE
Dear all, This is my first attempt at Mbed and my hello world was to blink LED later I added printf function to test VCP. It works but TeraTerm hang after over about 100 lines or so. I later tried to use "pc.printf" the LED just blink once and stopped no output at terminal. In my exasperation I tried to import a sample pc.printf project and changed it to my earlier program and it work! Why does same code only works when in different project? (By the way the hanging of TeraTerm still persisted). Here are the code:
#include "mbed.h" Serial pc(USBTX, USBRX); DigitalOut myled(LED1); int main(void) { int nr=0; while (1){ myled = 1; // LED is ON wait(0.25); // 250 ms myled = 0; // LED is OFF wait(0.25); // 250 ms // printf("was previously printf %u\r\n",nr++); pc.printf("HelloLine %u\r\n",nr++); } }
Appreciate if anyone can help on this. Thanks!
2 Answers
9 years, 2 months ago.
I don't see why Teraterm is hanging, I'll see if I can have a look at it later.
Why your new project could be different is that you have a newer/older version of the mbed lib. If you right click, update, on the mbed lib you have the latest version (which to be fair is not always the best version).
Can you add your code inside
posted by Erik - 06 Oct 2015<<code>> and <</code>>
(on seperate lines), then it is properly formatted.