SoftwareSerial What did I do wrong? Solved!

I tried to read out of my SoftwareSerial via simple wire into another Arduino

(both Lilypad Simple)http://www.sparkfun.com/products/10274

and get the other one to blink Led13.
I have connected Rx on the sender to Tx on the receiver and vice versa.
I have given both a nice LiPo 3.7 W that lights everything properly usually.
It doesn’t work.
So, if the other Arduino doesn’t get the read via cable, it won’t print it into the Xbee when I hook it onto that pair of pins later, right?
What have I done wrong-still?

#include <SoftwareSerial.h>

const int RXPin = A5;              // setting the pin to RX
const int TXPin = A3;              // setting the pin to TX

SoftwareSerial xbee (RXPin, TXPin);// defining the new serial name

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

void loop()
{
  xbee.print('H');                  // send the letter H out
  delay(1000);                      // wait for one second
  xbee.print('L');                  // send the letter L out
  delay(1000);                      // wait for one second
}
#include <SoftwareSerial.h>

const int RXPin = A5;        // change the pin into the RX
const int TXPin = A3;        // change the pin into the TX
int ledPin = 13;

SoftwareSerial xbee (RXPin, TXPin);//naming the new serial

void setup()
{
  pinMode(ledPin, OUTPUT);   //initialize the digital pin as output
  xbee.begin(9600);
}

void loop()
{
  if (xbee.read() == 'H')
  digitalWrite(ledPin, HIGH);// set the LED on
  delay(1000);               // wait for a second
  digitalWrite(ledPin, LOW); // turn the LED off
  delay(1000);               // wait for a second
}

Did you also connect Ground between the two? The serial signals are relative to Ground so you need three wires.

Try this void loop() { if (xbee.read() == 'H') digitalWrite(ledPin, HIGH); // set the LED on if (xbee.read() == 'L') digitalWrite(ledPin, LOW); // turn the LED off } Only turn light on if "H" received and turn light off if "L" received, the timing is decided by transmitter. The TX from RX unit is not needed, but is wired RIGHT!

HUDIBRAS

Thank you.
No blinking of LED13.
I tried both tips.
Wired additionally minus to minus and rewrote the receiver code to

#include <SoftwareSerial.h>

const int RXPin = A5;        // change the pin into the RX
const int TXPin = A3;        // change the pin into the TX
int ledPin = 13;

SoftwareSerial xbee (RXPin, TXPin);//naming the new serial

void setup()
{
  pinMode(ledPin, OUTPUT);   //initialize the digital pin as output
  xbee.begin(9600);
}

void loop()
{
  if (xbee.read() == 'H') digitalWrite(ledPin, HIGH); // set the LED on
  if (xbee.read() == 'L')  digitalWrite(ledPin, LOW); // turn the LED off
 }

What can I do?

How about some debugging using the Serial Monitor? Since your default Rx/Tx ports are free, print whatever comes from the ZigBee sender to make sure you got the characters arriving properly!

Hi again.
If anyone still wants to help me.
Here are 2 photos how I have wired the two Arduinos Simple Boards.
Imgur

Thank you charalamposdoukas. I keep the receiver always connected to the USB, (that's the only RXTX connection possibility with these simplified boards) and have the serial monitor on. Nothing comes out of the new SoftwareSerial ports, though.

You seems using analog pin ?

If it's then case, then you must IMO use digital pins !

Thanks Grag38. I'm not sure which ones those are, but I just tried with 10,11, which also didn't produce anything. Could you expand a little?

I was also reading that I should include the line
{
if(xbee.available() > 0)
{
myValue = xbee.read();
}
but there is always the error coming:
error: ‘myValue’ was not declared in this scope
and:
error: ‘class SoftwareSerial’ has no member named ‘available’

#include <SoftwareSerial.h>

const int RXPin = A5;              // setting the pin to RX
const int TXPin = A3;              // setting the pin to TX

SoftwareSerial xbee (RXPin, TXPin);// defining the new serial name

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

void loop()
{
  if(xbee.available() > 0)
{
myValue = xbee.read();
}xbee.print('H');                  // send the letter H out
}

Not shure your sketch is good considering the NewSoftware serial library.

the print command is not into the library.

so from try for the server :

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11);

void setup()  
{
  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  mySerial.println("Hello, world?");
}

void loop() // run over and over
{
    mySerial.write('H');
    delay(1000);
    mySerial.write('L');
}

and to the receiver :

SoftwareSerial mySerial(10, 11);

int ledPin = 13;

void setup()  
{
  pinMode(ledPin, OUTPUT);   

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  mySerial.println("Hello, world?");
}

void loop() // run over and over
{
  if (mySerial.available())
  {
      char ch;


     ch = mySerial.read();

     if (ch=='H') digitalWrite(ledPin, HIGH);

     if (ch=='L') digitalWrite(ledPin, LOW);
    
  }
}

Thanks Grag38. Looks more sophisticated. Unfortunately I get these errors when compiling: sketch_may29d.cpp:4:1: error: ‘SoftwareSerial’ does not name a type sketch_may29d.cpp: In function ‘void setup()’: sketch_may29d.cpp:13:3: error: ‘mySerial’ was not declared in this scope sketch_may29d.cpp: In function ‘void loop()’: sketch_may29d.cpp:19:7: error: ‘mySerial’ was not declared in this scope

On the receiver I added the line on the top that was missing in this code:
#include <SoftwareSerial.h>
So now there is only this error that always comes when I use the “available”
sketch_may29f.cpp: In function ‘void loop()’:
sketch_may29f.cpp:20:16: error: ‘class SoftwareSerial’ has no member named ‘available’

And on the server there are these errors coming: xbeetry5server.cpp: In function ‘void loop()’: xbeetry5server.cpp:17:14: error: ‘class SoftwareSerial’ has no member named ‘write’ xbeetry5server.cpp:19:14: error: ‘class SoftwareSerial’ has no member named ‘write’ What does that mean?

It´s the Linux Arduino! Thanks everyone! I went on a windows pc and it worked perfectly. Somehow the Linux version Arduino 1.01 that I had no problems programming other Arduino stuff with, has a problem with the SoftwareSerial. It doesn't understand: write and available. Its now only a minor nuissance but: Does anyone have an idea how to use a Linux Notebook with SoftwareSerial now? Otherwise I have to sneak into my sons room and use his Microsoft Computer...