Active oldest votes. Up vote 1 down vote accepted. String concatenation can be very useful when you need to display a combination of values and the descriptions of those values into one String to display via serial communication. Nov 01, 2009 The Serial.print method has several overloads. The single argument method takes whatever value it receives and sends it as a character. The two argument method allows you to define how the value is sent. You want to use the two argument method like this: Serial.print(tempC, DEC); This will send the value as an int rather than as a char. Use Serial.print to display Arduino output on your computer monitor: Part 2. The print statement is interpreting this as an integer (16bits) instead of two 8 bit characters because in C the character literal is defined as an int and your providing just the right number of 8.
Active12 months ago
I've this code:
and works fine. There's an example of the output:
Aug 08, 2011 A Better Serial.print For Arduino Posted on August 8, 2011 by David Pankhurst In a previous article I described how to add the old-fashioned print function to Arduino to improve debugging – after all, it gets tedious to use a separate Serial.print function for each type – and inserting information into a string is printf’s specialty.
but I wonder if there's a way to write the four sentences in one with something like:
that returns an error:
Any idea?. Thanks in advance.
Serial Print Values List
Salvador Rueda
Salvador RuedaSalvador Rueda30311 gold badge44 silver badges1212 bronze badges
2 Answers
String concatenation can be very useful when you need to display a combination of values and the descriptions of those values into one String to display via serial communication.
We can concatenate multiple values, forming a string with all the data and then send it.This can also be used with LCD dislpay.
user3923880user3923880
Arduino Serial Print Multiple Values
There is a quicker way:Just convert your output directly to a String:
GuestGuest
![Print Print](https://i.ytimg.com/vi/1sXAw-qpx6w/hqdefault.jpg)
Not the answer you're looking for? Browse other questions tagged arduino-ide or ask your own question.
Description
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or 'r') and a newline character (ASCII 10, or 'n'). This command takes the same forms as Serial.print().
Syntax
Parameters
Serial
: serial port object. See the list of available serial ports for each board on the Serial main page.val
: the value to print. Allowed data types: any data type.format
: specifies the number base (for integral data types) or number of decimal places (for floating point types).Returns
Arduino Serial Print Two Values
println()
returns the number of bytes written, though reading that number is optional. Data type: size_t
.