Hello Richard
I have tried to translate below.
You can do better somethings, but it runs ok.
I hope that you understand the code better now.
A greeting,
Juan Antonio.
----- Original Message -----
From: Richard
To: Juan Antonio LXXXpez Riquelme
Cc: [email protected]
Sent: Friday, March 21, 2008 12:49 PM
Subject: Re: [Tinyos-help] how to activate built-in sensirion temp sensor
intelosB
thanks sir. I will try it. But do you have code that is in english? thank you.
Juan Antonio L�pez Riquelme <[EMAIL PROTECTED]> wrote:
Hello Richard
You use the following component and wiring in the configuration:
components new SensirionSht11C() as Sht11;
App.Humidity -> Sht11.Humidity;
App.Temperature -> Sht11.Temperature;
In the module:
module SHT11C
{
...
uses interface Read<uint16_t> as Humidity;
uses interface Read<uint16_t> as Temperature;
}
implementation
{
bool ReadHumidity = FALSE;
bool ReadTemperature = FALSE;
uint16_t dataHumidity, dataTemperature;
//Init the read of the sensor
if (call Humidity.read() != SUCCESS)
call Leds.led2Toggle(); // show error.
else ReadHumidity = TRUE;
if (call Temperature.read() != SUCCESS)
call Leds.led2Toggle(); // Show error.
else ReadTemperature = TRUE;
//Events with the data
event void Humidity.readDone(error_t result, uint16_t data)
{
uint16_t aux = data;
if (result != SUCCESS)
{
aux = 0xffff;
call Leds.led2Toggle(); // Show error.
}
dataHumedity = aux;
ReadHumidity = FALSE;
atomic if(!ReadHumidity & !ReadTemperature) post FunctionSendData();
}
event void Temperature.readDone(error_t result, uint16_t data)
{
uint16_t aux = data;
if (result != SUCCESS)
{
aux = 0xffff;
call Leds.led2Toggle(); // Show error.
}
dataTemperature = aux;
ReadTemperature = FALSE;
atomic if(!ReadHumidity & !ReadTemperature) post FunctionSendData();
}
I hope that help you.
A greeting,
Juan Antonio
----- Original Message -----
From: Richard
To: [EMAIL PROTECTED] ; [EMAIL PROTECTED]
Cc: [email protected]
Sent: Friday, March 21, 2008 8:48 AM
Subject: [Tinyos-help] how to activate built-in sensirion temp sensor
intelosB
Sir/Ma'am,
May I ask your guidance and suggestion on how to make the temperature and
humidity sensor of telosB work? I have difficulty in making it work. By the
way, I already made the two other sensors (TSR and PAR) worked. But I cannot
make the Humidity and Temperature sensor work in the telosB. Do I need to have
Humidity.h file? Because in my case, the HumidityC.nc and HamamatsuC.nc which
are used for Temperature/Humidity and TSR/PAR respectively are located in telos
folder inside platform folder. Not in the telosb folder. Thank you.
Richard
--------------------------------------------------------------------------
Looking for last minute shopping deals? Find them fast with Yahoo!
Search.
--------------------------------------------------------------------------
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
------------------------------------------------------------------------------
Looking for last minute shopping deals? Find them fast with Yahoo! Search._______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help