Reference.SoftwareSerialPrintln History

Show minor edits - Show changes to markup

May 25, 2012, at 03:52 PM by Tom Igoe -
Changed line 18 from:

SoftwareSerial serial(6, 7);

to:

SoftwareSerial serial(10,11);

Changed lines 29-30 from:
  analogValue = analogRead(0);
to:
  analogValue = analogRead(A0);
November 04, 2011, at 02:56 PM by Scott Fitzgerald -
Changed line 18 from:

SoftwareSerial mySerial(6, 7);

to:

SoftwareSerial serial(6, 7);

Changed line 23 from:
  mySerial.begin(9600);
to:
  serial.begin(9600);
Changed lines 28-32 from:
  mySerial.write(45); // send a byte with the value 45

   int bytesSent = mySerial.write(“hello”); //send the string “hello” and return the length of the string.
to:
  // read the analog input on pin 0:
  analogValue = analogRead(0);

  // 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);
November 04, 2011, at 02:55 PM by Scott Fitzgerald -
Changed line 18 from:

SoftwareSerial serial(6, 7);

to:

SoftwareSerial mySerial(6, 7);

Changed line 23 from:
  serial.begin(9600);
to:
  mySerial.begin(9600);
Changed lines 28-50 from:
  // read the analog input on pin 0:
  analogValue = analogRead(0);

  // 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);
to:
  mySerial.write(45); // send a byte with the value 45

   int bytesSent = mySerial.write(“hello”); //send the string “hello” and return the length of the string.
November 04, 2011, at 02:50 PM by Scott Fitzgerald -
Changed lines 13-14 from:

none

to:

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

Changed lines 17-18 from:

[@SoftwareSerial serial(6, 7);

to:
Changed lines 51-52 from:

} @]

to:
May 17, 2007, at 05:05 PM by David A. Mellis -
Changed lines 1-2 from:

SoftwareSerial.println(data)

to:

SoftwareSerial: println(data)

Changed lines 54-56 from:
to:
December 23, 2006, at 05:16 AM by David A. Mellis -
Added lines 1-56:

SoftwareSerial.println(data)

Description

Prints data to the transmit pin of the software serial port, followed by a carriage return and line feed. Works the same as the Serial.println() function.

Parameters

vary, see Serial.println() for details

Returns

none

Example

SoftwareSerial serial(6, 7);
int analogValue;

void setup()
{
  serial.begin(9600);
}

void loop()
{
  // read the analog input on pin 0:
  analogValue = analogRead(0);

  // 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);
} 

See also

Share