There is so much missing from you post that it is hard to know where to begin.
You appear to have an XBee connected to the PC. I don't suppose that you are using duct tape, but there is nothing that explains just how the XBee is connected.
You appear to have an XBee connected to the Arduino. I don't suppose that you are using duct tape, but there is nothing that explains just how the XBee is connected.
You seem to think that the XBees can communicate, but there in nothing that explains how they are configured, so there is no basis for assuming that they can indeed communicate.
You seem to have some code on the Arduino, but you didn't share it. You'd be voted out of Mr. Roger's neighborhood.
The first xbee is on an AE-Xbee-USB and is connected to the pc vie USB. I used XCTU to set as Coordinator API-2.
The second Xbee is on an AE-Xbee-Reg-DIP which is connectet to the arduino with 2 wires (RX/TX).
It is an Router API-2. Data sampling is turned off.
Sending frames from one xbee to the other is no problem. Sampling data with the second xbee and sending it to the first works good.
So my arduino is getting datathrough i2c. This works too.
As i said the goal is to send the sampled date with the second xbee. Would it be better to use the second xbee in AT mode? do i have to build the frames that will be send with in the program?
#include <SoftwareSerial.h> #include <Wire.h>
byte val = 10001100;
SoftwareSerial xbee(2, 3); // RX, TX
which is connectet to the arduino with 2 wires (RX/TX).
It takes a minimum of 4 wires - power, ground, data out, and data in. You're only half way there.
Would it be better to use the second xbee in AT mode?
The two XBees need to use the same mode. Since the microcontroller on the XBee is not collecting data or toggling output pins, it is far easier if both are in AT mode.
do i have to build the frames that will be send with in the program?
In API mode, yes.
xbee.println( h );
That is NOT how to send data in API mode. That IS how to send data in AT mode. (See why AT mode is better?)
I did all you recommended. I connected Vcc and Gnd directly to my Arduino and i set both my Xbees to AT mode.
The problem is, i still don`t get any signal on my coordinator.
may there be a problem with my xbee setting?
Coordinator:
ID 2001
The rest is on default right now.
Router:
ID 2001
DH 13A200 (SH of Coordinator)
DL 40B414AE (SL of Coordinator)
The rest is on default. So IR, IC is 0
And the D1, D5, D7 P0 ar 1 the others are 0. SM is 0 too because it`a router.
What version of the IDE does that compile on? Calling SoftwareSerial::begin() with an instance of the HardwareSerial class is not supported on any version of the IDE that I have used.