Go Down

Topic: sending data from one Arduino to another via xbee (Read 1 time) previous topic - next topic

evlash

Hello I am trying to send data from a text file that is stored on an SD card on one Arduino to another Arduino and then store it on a second SD card. I am able to open the file and display it in the serial monitor but I am unable to send it to the other Arduino. I am using series 1 Xbee's that were purchased as a kit. They are connected to the 0 and 1 pins of the Arduino. How would I go about sending the data?

thrasiel

hello friend, maybe this could help, it send numbers from one arduino to another.

http://arduino.cc/forum/index.php/topic,99225.0.html

regards.

evlash

O.K thanks I have semi figured it out. I am encountering a small problem however. I have the two Arduinos hooked up to separate computers. When I type in something into the serial monitor on one I receive it in the the other. The problem I encounter is when I type more than one letter or number in the serial monitor I receive strange characters. What could be causing this? Both Arduinos have the below sketch uploaded.


#include <SoftwareSerial.h>

#define Rx    0                     // DOUT to pin 6
#define Tx    1                     // DIN to pin 7
SoftwareSerial Xbee (Rx, Tx);

void setup() {
  Serial.begin(57600);               // Set to No line ending;
  Xbee.begin(57600);                //   type a char, then hit enter
  delay(100);
}

void loop() {
  if(Serial.available()) {          // Is serial data available?
    char outgoing = Serial.read();  // Read character, send to XBee
    Xbee.print(outgoing);
  }

  if(Xbee.available()) {            // Is data available from XBee?
    char incoming = Xbee.read();    // Read character,
    Serial.println(incoming);       //   send to Serial Monitor
  }

  delay(50);
}

Cybernetician

#3
Nov 19, 2012, 07:05 am Last Edit: Nov 19, 2012, 07:08 am by Cybernetician Reason: 1
Code: [Select]
if(Serial.available()) {          // Is serial data available?
   char outgoing = Serial.read();  // Read character, send to XBee
   Xbee.print(outgoing);
 }



May be this is problem

Code: [Select]

if(Serial.available()) {          // Is serial data available?
   while(Serial.available()){
   char outgoing = Serial.read();  // Read character, send to XBee
   Xbee.print(outgoing);
   }
 }


And use insert # (code options)
Code: [Select]
 
From Idea To Invention

PaulS

Code: [Select]
#define Rx    0                     // DOUT to pin 6
#define Tx    1                     // DIN to pin 7
SoftwareSerial Xbee (Rx, Tx);

0 != 6
1 != 7

Doing software serial on the hardware serial pins does not work. Frankly, it borders on stupid to even try, especially when using the hardware serial pins to do hardware serial, too.

Go Up