NewSoftSerial newbie question

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
joanba
 
Posts: 27
Joined: Tue Oct 30, 2012 6:57 am

NewSoftSerial newbie question

Post by joanba »

Hi,

I'm trying to understand how the NewSoftwareSerial library works. I'm trying to run the provided examples and I'm not able to see the output of functions like nss.print or nss.println. For example:

#include <XBee.h>
#include <SoftwareSerial.h>

uint8_t ssRX = 8;
uint8_t ssTX = 9;
SoftwareSerial nss(ssRX, ssTX);

XBee xbee = XBee();

ZBRxIoSampleResponse ioSample = ZBRxIoSampleResponse();

XBeeAddress64 test = XBeeAddress64();

void setup() {
Serial.begin(9600);
xbee.setSerial(Serial);
// start soft serial
nss.begin(9600);

Serial.print("Setup done !!");
}

void loop() {

//attempt to read a packet
xbee.readPacket();

if (xbee.getResponse().isAvailable()) {
// got something
Serial.print("Got something !!");

if (xbee.getResponse().getApiId() == ZB_IO_SAMPLE_RESPONSE) {
xbee.getResponse().getZBRxIoSampleResponse(ioSample);

nss.print("Received I/O Sample from: ");

(...) it continues, example is named Series2_IoSamples.

My question is what I need to setup in order to see the nss.print output. I see that is configured to arduino pins 8 and 9, but what I need to connect there ? Is there an easy way to redirect all this output to the serial monitor for example ? Or I need to change all code from nss.print to Serial.print...

Regards,
Joan

User avatar
adafruit_support_bill
 
Posts: 88092
Joined: Sat Feb 07, 2009 10:11 am

Re: NewSoftSerial newbie question

Post by adafruit_support_bill »

I see that is configured to arduino pins 8 and 9, but what I need to connect there ?
You need a TTL serial device of some kind. If you connect an FTDI or other USB/Serial cable, you can see the output with a terminal emulator program on your computer.

Alternately, you could display it on an LCD display with a serial backpack.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”