Pages: [1]   Go Down
Author Topic: sending data from one Arduino to another via xbee  (Read 957 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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);
}
Logged

Offline Offline
Full Member
***
Karma: 4
Posts: 187
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
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:
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:
 
« Last Edit: November 19, 2012, 01:08:24 am by Cybernetician » Logged

From Idea To Invention

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 615
Posts: 49388
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
#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.
Logged

Pages: [1]   Go Up
Jump to: