Newbie on Xbee and idigi need to read a var inside xbee via idigi

I changed it again to make it easier to understand.

void main(void)
{

wpan_envelope_t env;
uint32_t now, before;





wpan_envelope_create(&env, &xdev.wpan_dev, WPAN_IEEE_ADDR_COORDINATOR,
					 WPAN_NET_ADDR_UNDEFINED);
env.payload = buffer;




sys_hw_init();
sys_xbee_init();
sys_app_banner();




for (;;) {

now = rtc_get_uptime();

			if (before < now-20) {
				before = now;
					/* Construct and send the message... */
					env.length = sprintf(buffer, "idigi_data:"
					        "names=var1, var2"
					        "&values=%d,%d"
					        "&units=C

,RH%
",saiuBtoA,saiuAtoB);
xbee_transparent_serial(&env);

			}
	sys_watchdog_reset();
	
	sys_xbee_tick();
}

}

Hello Danillo,

I am not sure about what the problem is, as far as I understand, the data streams should be generated automatically by XIG, but the variables’ names are the ones that you specify here:

env.length = sprintf(buffer, "idigi_data:"
"names=var1, var2"
"&values=%d,%d"
"&units=C
,RH%
",saiuBtoA,saiuAtoB);
xbee_transparent_serial(&env);

So, sauiBtoA will be var1 and sauiAtoB will be var2. Are those streams created? Also, in your code you are not initializing the variable before. Are you able to see anything in the XIG log? Try sending the message manually in XIG’s console to see if it uploads the samples.

Here is my version of your code (enable periodic tasks in RTC component at config.xml or remove its code to make it build). Also, find the screenshots of my iDigi account, the XIG web interface and the XIG command-line output.

Hope it helps, “sorte!”. Best regards,


#include 
#include 
#include 

int saiuAtoB = 0, saiuBtoA = 0;
uint8_t buffer[100];

#if defined(RTC_ENABLE_PERIODIC_TASK)
void rtc_periodic_task(void)
{
	saiuAtoB += 1;
	saiuBtoA += 2;
}
#endif

void main(void)
{
	uint32_t now = 0, before = 0;
	wpan_envelope_t envelope;
	
	sys_hw_init();
	sys_xbee_init();
	sys_app_banner();

	wpan_envelope_create(&envelope, &xdev.wpan_dev, WPAN_IEEE_ADDR_COORDINATOR, WPAN_NET_ADDR_UNDEFINED);
	envelope.payload = buffer;
	
	now = rtc_get_uptime();
	before = now - 20; /* To send first message */

	for (;;) {
		now = rtc_get_uptime();
		
		if (before == now - 20) {
			before = now;
			/* Construct and send the message... */
			envelope.length = sprintf(buffer, "idigi_data:"
			"names=saiuBtoA,saiuAtoB"
			"&values=%d,%d&units=BtoA,AtoB
"
			,saiuBtoA, saiuAtoB);
			xbee_transparent_serial(&envelope);
		}
		sys_watchdog_reset();
		sys_xbee_tick();
	}
}

First of all thank you I am stuck and almost losing hope.

The main diference between what I am receiving is that I don’t have the idigi data.

But the other diference is the xbee. My xbee does not connect to xig I don’t know why but it only connects whem at debug mode if I use my program it stops the connection.

What should I do to use the debug mode and my program together?

First of all thank you I am stuck and almost losing hope.

The main diference between what I am receiving is that I don’t have the idigi data.

But the other diference is the xbee. My xbee does not connect to xig I don’t know why but it only connects whem at debug mode if I use my program it stops the connection.

What should I do to use the debug mode and my program together?

When I said debug mode I mean the bootloader did you get it?

Hello Danillo,

OK, so the first step should be to make that work or you will be losing your time. In the last release of Programmable XBee SDK there are some examples with iDigi, XIG and Programmable XBee, check them out.

Download the latest version here (Programmable XBee ZB Development Kit: Download and install the Programmable XBee SDK)

Happy new year!