You should be able to use VoltageC to get the value.
The difference in the two DemoSensorC examples you
have is that someone decided to use DemoChannel
as an intermediate name rather then DemoSensor,
probably to enhance code re-usability (not).

It may be that the simulator implementation returns
a fixed value, but most real mote impl's should read
the ADC and make some attempt to convert the value
to millivolts.

If you are trying to make any use of this value vis
power reserves, search this list for lots of discussion.

MS

Paul Gildea wrote:
> Hello, I am wondering how I can return and display the battery level of 
> micaz motes. I wish to retrieve battery levels from micaz motes and 
> broadcast these values to other motes who will store them in a table, 
> perhaps to try routing via these values and AODV, and am wondering how 
> to go about this? I Am very lost at the moment.
> 
>  To get the voltage do you use VoltageC.nc from /platforms/mica? I see 
> references to VoltageM also but can not locate that, is that removed? In 
> the Oscilloscope examples I see that DemoSensorC is wired to VoltageC 
> but does it return the voltage or some constant value as is said in the 
> comments of the file. The code for DemoSensorC for micaz 
> 
> 
> 
> generic configuration DemoSensorC()
> {
>   provides interface Read<uint16_t>;
> }
> implementation
> {
>   components new VoltageC() as DemoChannel;
> 
>   Read = DemoChannel;
> }
> 
> is very similar to that of  DemoSensorC for telosB
> 
> 
> generic configuration DemoSensorC()
> {
>   provides interface Read<uint16_t>;
> }
> implementation
> {
>   components new VoltageC() as DemoSensor;
>   Read = DemoSensor;
> }
> 
> with only the last line changing. Why does the the former report a 
> constant value and the latter the voltage of the battery?
> 
> Thanks!
> 
> -- 
> Paul
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help@millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to