Arduino prints float/double variable with decimal places
How to print float/double variable with two or three decimal places to Serial Monitor on Arduino?
The below Arduino code print float and double number to Serial Monitor with one, two, three and four decimal places.
The result on Serial Monitor
Please note that the number will be rounded before being printed. As you can see on Serial Monitor, when printing 0.123456 with four decimal places, it is rounded to 0.1235
|1 × Arduino UNO Buy on Amazon|
|1 × USB 2.0 cable type A/B Buy on Amazon|
|1 × Jumper Wires Buy on Amazon|