i want 0.2 incriment float, not 0.20!

any one know when using a float variable, how to only show only 1 figure after the decimal place not 2 figures?

I define the float as myval

then I've got myval += 0.2

but when it counts in the serial print it shows 0.20, 0.40, 0.60 etc. but I don't need the extra zero!

Serial.println(myval, 1);

Thankyou very much!

It works perfectly! but can you explain what the comma and the 1 actually does please

Arduino - Println

stuwilson:
It works perfectly! but can you explain what the comma and the 1 actually does please

The "comma 1" tells print to only print one decimal place. For example, if you have this:

float x = 123.456789;

Serial.print (x, 1) produces "123.5" (note 1 decimal place and rounded up)
Serial.print (x, 5) produces "123.45679" (note 5 decimal places and rounded up)
Serial.print (x, 0) produces "123" (no decimal place, and no need to round up)

Hope this helps.