So ive been trying for the last two days to get this to work but i have a feeling im getting it completely wrong i have two seeeduinnos with bees shields and rfbees, which im trying to send data between using software serial but i can not get them to work i have a feeling i may need the rfbee library or something, but cant find any info anywhere.
both jumpers on the bees shields are bee1_tx=12 and both bee1_rx=11.
Here is the code i have which isnt working:
Sender:
[code]#include <SoftwareSerial.h> // Software Serial Port
#define RxD 12
#define TxD 11
SoftwareSerial rfbeeserial(RxD,TxD);
void setup(void)
{
//Debug
Serial.begin(9600);
Serial.println("Starting Setup");
//rfbee Setup
pinMode(RxD, INPUT);
pinMode(TxD, OUTPUT);
Serial.println(“FInished Setup”);
}
void loop(void)
{
Serial.println(“L[1,1]”);
rfbeeserial.println(“L[1,1]”);
delay(1500);
Serial.println(“L[1,0]”);
rfbeeserial.println(“L[1,0]”);
delay(1500);
}
[/code]
and receiver
[code]#include <SoftwareSerial.h> //Software Serial Port
#define RxD 12
#define TxD 11
SoftwareSerial rfbeeserial(RxD,TxD);
char incoming; //Data From other arduino
void setup()
{
//Debug
Serial.begin(9600);
Serial.println(“Starting Setup”);
//rfbee Setup
pinMode(RxD, INPUT);
pinMode(TxD, OUTPUT);
//Lights
pinMode(13,OUTPUT);
Serial.println("Finished Setup");
}
void loop()
{
Serial.println(“Loop”);
while(rfbeeserial.available() > 0) // Don’t read unless //Sample string L[1,0] // there you know there is data
{
Serial.println(“Incoming Data”);
incoming = rfbeeserial.read();
if(incoming=='L') {
Serial.println("Light Command");
rfbeeserial.read(); //read the [
int light = rfbeeserial.read(); //read the led
rfbeeserial.read(); //read the ,
int on = rfbeeserial.read(); //read the state
rfbeeserial.read(); //read the ]
updateLight(light-'0',on-'0');
}
}
delay(100);
}
void updateLight(int light,int on) {
if(light==1 &&(on==1||on==0)) {
Serial.print("Light: ");
Serial.println(light);
Serial.print("On: ");
Serial.println(on);
if(on==1) {
digitalWrite(13, HIGH);
} else {
digitalWrite(13, LOW);
}
}
}
[/code]
Any help would be appreciated