You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Language/Functions/Communication/Serial/print.adoc
+12-11Lines changed: 12 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -16,20 +16,21 @@ title: Serial.print()
16
16
=== Description
17
17
Prints data to the serial port as human-readable ASCII text. This command can take many forms. Numbers are printed using an ASCII character for each digit. Floats are similarly printed as ASCII digits, defaulting to two decimal places. Bytes are sent as a single character. Characters and strings are sent as is. For example-
An optional second parameter specifies the base (format) to use; permitted values are `BIN(binary, or base 2)`, `OCT(octal, or base 8)`, `DEC(decimal, or base 10)`, `HEX(hexadecimal, or base 16)`. For floating point numbers, this parameter specifies the number of decimal places to use. For example-
25
26
26
-
* `Serial.print(78, BIN) gives "1001110"` +
27
-
* `Serial.print(78, OCT) gives "116"` +
28
-
* `Serial.print(78, DEC) gives "78"` +
29
-
* `Serial.print(78, HEX) gives "4E"` +
30
-
* `Serial.print(1.23456, 0) gives "1"` +
31
-
* `Serial.print(1.23456, 2) gives "1.23"` +
32
-
* `Serial.print(1.23456, 4) gives "1.2346"`
27
+
* `Serial.print(78, BIN)` gives "1001110" +
28
+
* `Serial.print(78, OCT)` gives "116" +
29
+
* `Serial.print(78, DEC)` gives "78" +
30
+
* `Serial.print(78, HEX)` gives "4E" +
31
+
* `Serial.print(1.23456, 0)` gives "1" +
32
+
* `Serial.print(1.23456, 2)` gives "1.23" +
33
+
* `Serial.print(1.23456, 4)` gives "1.2346"
33
34
34
35
You can pass flash-memory based strings to Serial.print() by wrapping them with link:../../../../variables/utilities/progmem[F()]. For example:
0 commit comments