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