Skip to content

Commit 57be0d5

Browse files
committed
Added float example to StringConstructor
This example has been added according to #3264
1 parent 0413144 commit 57be0d5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

examples/08.Strings/StringConstructors/StringConstructors.ino

+8
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ void loop() {
6666
// prints "123456" or whatever the value of millis() is:
6767
Serial.println(stringOne);
6868

69+
//using a float and the right decimal places:
70+
stringOne = String(5.698, 3);
71+
Serial.println(stringOne);
72+
73+
//using a float and less decimal places to use rounding:
74+
stringOne = String(5.698, 2);
75+
Serial.println(stringOne);
76+
6977
// do nothing while true:
7078
while (true);
7179

0 commit comments

Comments
 (0)