Using the function on GR-KURUMI, Floating point numbers vol.
Let’s try to use floating point numbers
Login in web compiler and generate new project or re-open the project which you just built last time. Let's practice. Get ready Arduino pro mini to compare. Please refer to the code below.
Above code works on Arduino IDE but can’t compile on WEB compiler.
The chart is the execution result on Arduino pro mini.
Found that it’s rounded off to three decimal places.
If two decimal place is effective, seems it’s no problem to show the result of arithmetic operation.
However, someone may seek more accuracy.
※ Even it doesn’t have practical use.
Please refer to the following code.
Arduino IDE was not able to deal with %f in sprintf form. Such things will happen when using simplified printf version.
WEB compiler can deal with %f.
The result is in the data capture of Tera Term in the chart. On Arduino IDE, when you control the effective decimal place in floating point numbers by yourself, use dtostrf.
General hard engineer.. submitting his writing for technical magazine occasionally.