Arduino - SoftwareSerialPrint

Arduino

Reference Language | Libraries | Comparison | Changes

## SoftwareSerial: print(data)

#### Description

Prints data to the transmit pin of the software serial port. Works the same as the Serial.print() function.

#### Parameters

vary, see Serial.print() for details

#### Returns

byte
print() will return the number of bytes written, though reading that number is optional

#### Example

SoftwareSerial serial(10,11);
int analogValue;
void setup()
{
serial.begin(9600);
}
void loop()
{
// read the analog input on pin 0:
analogValue = analogRead(A0);
// print it out in many formats:
serial.print(analogValue); // print as an ASCII-encoded decimal
serial.print("\t"); // print a tab character
serial.print(analogValue, DEC); // print as an ASCII-encoded decimal
serial.print("\t"); // print a tab character
serial.print(analogValue, HEX); // print as an ASCII-encoded hexadecimal
serial.print("\t"); // print a tab character
serial.print(analogValue, OCT); // print as an ASCII-encoded octal
serial.print("\t"); // print a tab character
serial.print(analogValue, BIN); // print as an ASCII-encoded binary
serial.print("\t"); // print a tab character
serial.print(analogValue/4, BYTE); // print as a raw byte value (divide the
// value by 4 because analogRead() returns numbers
// from 0 to 1023, but a byte can only hold values
// up to 255)
serial.print("\t"); // print a tab character
serial.println(); // print a linefeed character
// delay 10 milliseconds before the next reading:
delay(10);
}
[Get Code]

#### See also

- SoftwareSerial()
- begin()
- read()
- println()

Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.

### Share

### This link has expired.
Please re-subscribe to our Newsletters.

### Subscribe to our Newsletters

Email

Please enter a valid email to subscribe

Arduino Newsletter
Arduino Store Newsletter

### Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy

###### Newsletter

- ©2015 Arduino
- Copyright Notice
- Contact us
- About us
- Careers