From c28fb7acd44f01c1522177c1ca806dded853d977 Mon Sep 17 00:00:00 2001 From: Arturo Guadalupi Date: Mon, 1 Jun 2015 09:48:28 +0200 Subject: [PATCH] Added float example to StringConstructor This example has been added according to #3264 --- .../08.Strings/StringConstructors/StringConstructors.ino | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build/shared/examples/08.Strings/StringConstructors/StringConstructors.ino b/build/shared/examples/08.Strings/StringConstructors/StringConstructors.ino index 315d0b646..30ac20cdd 100644 --- a/build/shared/examples/08.Strings/StringConstructors/StringConstructors.ino +++ b/build/shared/examples/08.Strings/StringConstructors/StringConstructors.ino @@ -66,6 +66,14 @@ void loop() { // prints "123456" or whatever the value of millis() is: 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: while (true);