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 printf a float data to serial on nrf51822?
I just find %f and %lf does not work on printf or Serial.printf, but the same code works fine on stm32 nucleo board.
Is there any difference in C libs?
Question relating to:
2 Answers
9 years, 2 months ago.
It should be the same. So if you run this code (entering the correct pins for tx and rx) you get the Hello but not the number?
Serial pc(tx,rx); main (){ float x = 10.2; pc.printf("Hello\r\n"); pc.printf("x= %.1f\r\n",x); }
Does anyone know that?
posted by Ma Yunfei 04 Oct 2015