Home/Support/Support Forum/2 Xbee Pro S1 communicating with Arduino

2 Xbee Pro S1 communicating with Arduino

0 votes
Trying to get the 2 Xbees to communicate through XCTU while arduino is outputting temperatures for the transmitting reciever reads the output temps. Issue is the 2 transmitters arent connecting with each other and not reading our temps from arduino.

Code so far:

#include <i2cmaster.h>
#include <SoftwareSerial.h>
#define rxPin 2
#define txPin 3
SoftwareSerial xbee = SoftwareSerial (rxPin, txPin);

void setup(){
pinMode (rxPin,INPUT);
pinMode (txPin, OUTPUT);
xbee.begin (9600);

i2c_init(); //Initialise the i2c bus
PORTC = (1 << PORTC4) | (1 << PORTC5);//enable pullups

void loop(){
int dev = 0x5A<<1;
int data_low = 0;
int data_high = 0;
int pec = 0;


// read
data_low = i2c_readAck(); //Read 1 byte and then send ack
data_high = i2c_readAck(); //Read 1 byte and then send ack
pec = i2c_readNak();

//This converts high and low bytes together and processes temperature, MSB is a error bit and is ignored for temps
double tempFactor = 0.02; // 0.02 degrees per LSB (measurement resolution of the MLX90614)
double tempData = 0x0000; // zero out the data
int frac; // data past the decimal point

// This masks off the error bit of the high byte, then moves it left 8 bits and adds the low byte.
tempData = (double)(((data_high & 0x007F) << 8) + data_low);
tempData = (tempData * tempFactor)-0.01;

float celcius = tempData - 273.15;
float fahrenheit = (celcius*1.8) + 32;

//Serial.print("Celcius: ");

Serial.print("Fahrenheit: ");
delay(1000); // wait a second before printing again
asked Apr 12, 2017 in XCTU by heytiffany New to the Community (0 points)

Please log in or register to answer this question.

2 Answers

0 votes
Have you tested the XBees without the Arduino to see if they can even communicate? The issue might not have anything to do with your code, and the fact that the radios are not configured.

The next thing assuming that the radios pass the range test (communicate in both directions) is for you to remove the radios out of the picture and simply wire the processor via the XBee's socket on your processor DI and DO lines ports on your interface board connected to the PC. You should then be able to use a terminal emulator such as XCTU to view the data being sent.
answered Apr 13, 2017 by DystopianFerret Veteran of the Digi Community (365 points)
edited Apr 13, 2017 by mvut
0 votes
Have you ran a range test as Dystopian has indicated to verify that the radios function in their default configuration?
answered Apr 13, 2017 by mvut Veteran of the Digi Community (13,104 points)