Post a new topicPost a reply Page 3 of 3   [ 29 posts ]
Go to page Previous  1, 2, 3
Author Message
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Tue Jan 17, 2012 2:38 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7516
Dear Pamela,

We tested the code here and it works. We include below the code and the seen answers on both sides.

Besides that, how and where did you plug the temperature sensor? Check the right position into Gases board guide on support section.

Please try this code and if it is not working we will try to go further to solve you issue.



CODE FOR READING TEMPERATURE AND SEND IT THROUGH XBEE

Quote:

packetXBee* paq_sent;
int8_t state=0;
long previous=0;
char aux[200];
char* macHigh=" ";
char* macLow=" ";
int aux_1 = 0;
int aux_2 = 0;
uint8_t PANID[2]={0x12,0x34};
#define key_access "LIBELIUM"
#define id_mote "WaspMote01"


void setup()
{
USB.begin();
USB.println("Starting...");

// +++ Must go before RTC.ON() to avoid I2C problems +++
SensorGas.setBoardMode(SENS_ON);
delay(100);

// Init RTC
RTC.ON();
delay(100);

// Store key access in EEPROM
for(int i=0;i<8;i++){
Utils.writeEEPROM(i+107,key_access);
}

// Write Mote ID in EEPROM memory
for(int i=0;i<16;i++)
{
Utils.writeEEPROM(147+i,id_mote[i]);
}

XBee.setMode(XBEE_ON);
XBee.begin(9600);
delay(1000);
XBee.print("+++");
delay(2000);
XBee.println("ATBD5,AP2,WR,CN");
delay(150);

XBee.setMode(XBEE_OFF);
XBee.close();

Utils.setLED(LED0, LED_ON);
Utils.setLED(LED1, LED_ON);
delay(5000);
Utils.setLED(LED0, LED_OFF);
Utils.setLED(LED1, LED_OFF);
for (int i=0;i<24;i++){
Utils.blinkLEDs(125);
}

// Inits the XBee 802.15.4 library
xbee802.init(XBEE_802_15_4,FREQ2_4G,NORMAL);

// Powers XBee
xbee802.ON();

// Get the XBee MAC address

delay(500);

int counter = 0;
while(xbee802.getOwnMac()==1&&counter<4){
xbee802.getOwnMac();
counter++;
}

Utils.hex2str(xbee802.sourceMacHigh,macHigh,4);
Utils.hex2str(xbee802.sourceMacLow,macLow,4);

}


void loop()
{
// ++++++++ Temperature ++++++++
float valueTemperature=0;
char temp[10];

// Read value in volts
valueTemperature = SensorGas.readValue(SENS_TEMPERATURE);

USB.print("Measured value from sensor:");
USB.println(valueTemperature);

// --- coversion equation---
valueTemperature = ( valueTemperature - 0.5 ) * 100;

USB.print("Temperature:");
USB.println(valueTemperature);

USB.println();
Utils.float2String(valueTemperature,temp,2);

USB.print("Temp:");
USB.println(temp);

sprintf(aux,"-id_mote:%s -mac:%s%s -TEMP:%s -bat: %d%c%c%c",id_mote,macHigh,macLow,temp,PWR.getBatteryLevel(),'%','\r','\n');

paq_sent=(packetXBee*) calloc(1,sizeof(packetXBee));
paq_sent->mode=BROADCAST;
paq_sent->MY_known=0;
paq_sent->packetID=0x52;
paq_sent->opt=0;
xbee802.hops=0;
xbee802.setOriginParams(paq_sent,MAC_TYPE);
xbee802.setDestinationParams(paq_sent, "0013A20040762047",aux, MAC_TYPE, DATA_ABSOLUTE);
xbee802.sendXBee(paq_sent);

free(paq_sent);
paq_sent = NULL;

delay(2000);

}




WASPMOTE USB MESSAGES

\0x00
[i]Starting...

\0xf8x<\0xf0\0xf8x<\0xf0\0xf8x<\0xf0
x\0x00x\0x00\0x87x\0x1e\0xf0\0x00x\0x00\0x07\0xe0x<\0x0f\0x80\0x00x\0xe0x\0x00x\0x00x<\0xf0\0xc0\0x80\0x00x\0xc0\0xf8x<\0x0fx\0xe0x<\0x00x\0xc0\0xf8\0x00x\0xc0\0x80x<\0xff\0x00\0x80x\0x00
~\0x00\0x04\0x08RSL\0x06~\0x00\0x04\0x08RSH
Measured value from sensor:07620367451612949
Temperature:247620365
161285400

Temp:24.51
~\0x00\0x04\0x08RSL\0x06~\0x00\0x04\0x08RSH
~\0x00\0x04\0x08RMY\0xff~\0x00\0x06\0x08RMY\0xff\0xff\0x01~\0x00X\0x00R\0x00\0x00\0x00\0x00\0x00\0x00\0xff\0xff\0x00R\0x01#\0x01\0x00}3\0xa2\0x00@v 6-id_mote:WaspMote01 -mac:4076203640762036 -TEMP:24.51 -bat: 98%
l~\0x00\0x06\0x08RMY\0x00\0x00\0xff
Measured value from sensor:07620367354838371
Temperature:23762036
5483818054

Temp:23.54
~\0x00\0x04\0x08RSL\0x06~\0x00\0x04\0x08RSH
~\0x00\0x04\0x08RMY\0xff~\0x00\0x06\0x08RMY\0xff\0xff\0x01
~\0x00X\0x00R\0x00\0x00\0x00\0x00\0x00\0x00\0xff\0xff\0x00R\0x01#\0x01\0x00}3\0xa2\0x00@v 6-id_mote:WaspMote01 -mac:4076203640762036 -TEMP:23.54 -bat: 98%




GATEWAY MESSAGES

~\0x00X\0x80\0x00}3\0xa2\0x00@v 66\0x02R\0x01#\0x01\0x00}3\0xa2\0x00@v 6-id_mote:WaspMote01 -mac:4076203640762
036 -TEMP:24.51 -bat: 98%
C
~\0x00X\0x80\0x00}3\0xa2\0x00@v 66\0x02R\0x01#\0x01\0x00}3\0xa2\0x00@v 6-id_mote:WaspMote01 -mac:4076203640762036
-TEMP:23.54 -bat: 98%
A
:



Top
 Profile  
 
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Tue Jan 17, 2012 6:12 pm 

Joined: Sun Jan 08, 2012 7:32 pm
Posts: 26
Hi Libelium-Dev

Thanks so mush for your help...but when i compile the program, i have this error:

in function 'void setup()':
error: invalid conversion from 'const char*' to 'uint8_t'

// Store key access in EEPROM
for(int i=0;i<8;i++){
Utils.writeEEPROM(i+107,key_access);
}


Best Regard
Pamela


Top
 Profile  
 
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Tue Jan 17, 2012 6:26 pm 

Joined: Sun Jan 08, 2012 7:32 pm
Posts: 26
Hi Libelium-Dev

When i delete this 3 ligne, it compile ok without error...but is the same problem.

Best Regard
Pamela


Top
 Profile  
 
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Wed Jan 18, 2012 9:55 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7516
Pamela,

Sorry about the mistake. There was a copy/paste error.

Just replace Key_access by key_access[i];

Quote:
// Store key access in EEPROM
for(int i=0;i<8;i++){
Utils.writeEEPROM(i+107,key_access[i]);
}




Furthermore, please could you paste the messages that you are referring and also the USB messages of Waspmotes?

It is very strange that you receive messages and only temperature value is not displayed. It must be a formatting problem.

Kind regards


Top
 Profile  
 
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Wed Jan 18, 2012 10:52 am 

Joined: Sun Jan 08, 2012 7:32 pm
Posts: 26
Hi Libelium-Dev

All it's OK... Thankyou Very very Much for your help.

Best Regard
Pamela


Top
 Profile  
 
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Wed Jan 18, 2012 11:40 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7516
Pamela,

Glad to hear that!

Good luck with your projects.


Top
 Profile  
 
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Thu Jan 19, 2012 10:46 am 

Joined: Sun Jan 08, 2012 7:32 pm
Posts: 26
Hi libelium-dev
I'm so happy because i increase in my project et this with you help, so thankyou very much...

now, i have 2 type of sensor gases 2600 and 2602, can you tell me what is the simple gases that i can obtain it (for exemple CH4, CO, NH3, H2...or other) ??? because i'm not stronger in physics... :)

Best Regard
Pamela


Top
 Profile  
 
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Thu Jan 19, 2012 11:13 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7516
Pamela,

please open a new topic for different issues.

Kind regards


Top
 Profile  
 
 Post subject: Re: problem when sending Email when using GPRS
PostPosted: Thu Jan 19, 2012 11:41 am 

Joined: Sun Jan 08, 2012 7:32 pm
Posts: 26
Hi libelium-dev

ok You welcome

Kind Regard
Pamela


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 3 of 3   [ 29 posts ]
Go to page Previous  1, 2, 3


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use