Hi David,
In the module file you should use the read interface as follows:
module Sensors
{
uses{
interface Read<uint16_t> as Sensor1;
interface Read<uint16_t> as Sensor2;
.
.
.
interface Read<uint16_t> as SensorN;
}
implementation{
event void Sensor1.readDone(error_t result, uint16_t val){
// Your code
}
event void Sensor2.readDone(error_t result, uint16_t val){
// Your code
}
.
.
.
event void SensorN.readDone(error_t result, uint16_t val){
// Your code
}
}
Then, in the configuration file you should wire the interfaces to the
implementations as follows:
configuration Sensors_App{}
implementation{
components Sensors, new Sensor1(), new Sensor2(), ... new SensorN();
Sensors.Sensor1 -> Sensor1.Read;
Sensors.Sensor2 -> Sensor2.Read;
.
.
.
Sensors.SensorN -> SensorN.Read;
Regards,
--
Mehmet Akif Antepli
On Wed, Feb 3, 2010 at 8:59 PM, David Guillén <
[email protected]> wrote:
> Hi all,
>
> I would like to read* from more than one sensor* in my application. I read
> the Sensing chapter of the TinyOS tutorial but I didn't find how to do it.
>
> I have the Read interface wired to the Temperature sensor and I would like
> to add a sensor for the Voltage to check the batteries. I am working with
> telosb.
> How could I distinguish between each reading? Is it something I have to do
> when I call Read.read()?? If it is like this, how I know, when I get the
> event Read.done, the data proceeding? Manually?
>
> thanks,
> David
>
> _______________________________________________
> 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