Hi. I tried already a lot, bought the books (wireless networks, Arduino etc.).
But not much success. Just built some Arduino projects.
I need to use the softserial but I seem to not find any simple forum post that covers it.
I want to hook the Xbees to Pin 5 and 6 because my Lilypad Simple Board has no Rx Tx pins. http://proto-pic.co.uk/lilypad-arduino-simple-board/?gclid=CL6_2LDMmbACFcshtAodpGq7Wg
I tried to use:
const int RXPin = 4;
const int TXPin = 5;
SoftwareSerial xbee =SoftwareSerial(RXpin, TXpin);
and I get the error message:
sketch_may24h.cpp:4:1: error: ‘SoftwareSerial’ does not name a type
or
SoftSerial.h: No such file or directory
Can you show me a way (Code) to get my 2 Xbee series 2 to talk to each other?
And if you want to help me further:
The goal of the project is a piece of interactive jewellery for my college project.
If you push a button that's attached to Pin9 the other one's LED on Pin11 lights up.
Also I would like Pin10 to light up if the Arduino-Xbees are in range and not light up when out of range.
Thanks.
Then the error:
In function ‘void setup()’:
7:1: error: ‘SoftwareSerial’ was not declared in this scope
7:16: error: expected ‘;’ before ‘xbee'
When I leave it away no error occurs:
but, does it then make the pins A5 and A3 Rx and Tx at all?
I have connected the Xbees with the so-called Lilypad Xbee,
but I might need an Xbee Adapter to access the Xbees beforehand, right?
Or could I modify the Lilypad Xbee breakoutboard maybe in conjunction
with the FTDI Basic from Sparkfun?
The Xbees 2 do need pairing first, right?
Thanks so much for your help!
I had to change the pins from 4 and 5 to A5 and A3, because there is no pin 4 on the Lilypad Simple Board...
God, I wish I had just bought the regular Lilypad with its RxTx!
I understand.
It has to be declared above. This doesn't produce an error any more.
So would this work now?
In order to check it, I need to read the
serial of the other Xbee now, right?
Hi again.
Now I tried it out -
to read out of my SoftwareSerial via simple wire into another Arduino (both Lilypad Simple) 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
}
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...