mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-20 14:54:31 +01:00
Merge pull request #3265 from agdl/StringConstructorFloatDouble
Added float example to StringConstructor
This commit is contained in:
commit
7e0dd9b974
@ -66,6 +66,14 @@ void loop() {
|
|||||||
// prints "123456" or whatever the value of millis() is:
|
// prints "123456" or whatever the value of millis() is:
|
||||||
Serial.println(stringOne);
|
Serial.println(stringOne);
|
||||||
|
|
||||||
|
//using a float and the right decimal places:
|
||||||
|
stringOne = String(5.698, 3);
|
||||||
|
Serial.println(stringOne);
|
||||||
|
|
||||||
|
//using a float and less decimal places to use rounding:
|
||||||
|
stringOne = String(5.698, 2);
|
||||||
|
Serial.println(stringOne);
|
||||||
|
|
||||||
// do nothing while true:
|
// do nothing while true:
|
||||||
while (true);
|
while (true);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user