Hello Richard
You use the following component and wiring in the configuration:
components new SensirionSht11C() as Sht11;
App.Humedad -> Sht11.Humidity;
App.Temperatura -> Sht11.Temperature;
In the module:
module SHT11C
{
...
uses interface Read<uint16_t> as Humedad;
uses interface Read<uint16_t> as Temperatura;
}
implementation
{
bool ReadHumedad = FALSE;
bool ReadTemperatura = FALSE;
uint16_t LecturaHumedad, LecturaTemperatura;
//Init the read of the sensor
if (call Humedad.read() != SUCCESS)
call Leds.led2Toggle(); // Mostrar error.
else ReadHumedad = TRUE;
if (call Temperatura.read() != SUCCESS)
call Leds.led2Toggle(); // Mostrar error.
else ReadTemperatura = TRUE;
//Events with the data
event void Humedad.readDone(error_t result, uint16_t data)
{
uint16_t aux = data;
if (result != SUCCESS)
{
aux = 0xffff;
call Leds.led2Toggle(); // Mostrar error.
}
LecturaHumedad = aux;
ReadHumedad = FALSE;
atomic if(!ReadHumedad & !ReadTemperatura) post FuncionEnviarDatos();
}
event void Temperatura.readDone(error_t result, uint16_t data)
{
uint16_t aux = data;
if (result != SUCCESS)
{
aux = 0xffff;
call Leds.led2Toggle(); // Mostrar error.
}
LecturaTemperatura = aux;
ReadTemperatura = FALSE;
atomic if(!ReadHumedad & !ReadTemperatura) post FuncionEnviarDatos();
}
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_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help