Hi,

Since I run into this too not long ago I try to answer it with my solution.
It is actually very simple - when you stop thinking that you should redefine 
the DemoSensor...
(as my first thought was)

Instead replace the DemoSensor with the predefined sensor you like to use.
In this example I am routing to the Z axis of an three axis accelerometer 
(mulle platform)
Since this sensor also has a Sleep interface I have to route to it too...

/RogerL

Index: apps/Oscilloscope/OscilloscopeAppC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/Oscilloscope/OscilloscopeAppC.nc,v
retrieving revision 1.2
diff -r1.2 OscilloscopeAppC.nc
23c23
<     new TimerMilliC(), new DemoSensorC() as Sensor, 
---
>     new TimerMilliC(), HplMMA7261QTC as Sensor, 
31c31
<   OscilloscopeC.Read -> Sensor;
---
>   OscilloscopeC.Read -> Sensor.AccelZ;
33c33
< 
---
>   OscilloscopeC.Enable -> Sensor.Sleep; /* Sleep is active low */ 
Index: apps/Oscilloscope/OscilloscopeC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/Oscilloscope/OscilloscopeC.nc,v
retrieving revision 1.6
diff -r1.6 OscilloscopeC.nc
28a29
>     interface GeneralIO as Enable;
57a59
>     call Enable.set();


Wagas wrote
>
> Hi everyone !
> 
> The 'Oscilloscope' application in tinyos-2.x uses the component DemoSensorC
> which acquires battery voltage from PMIC and displays it on java applet. So
> the sensor being used is taking value of battery voltage.I want the
> oscilloscope application to use the ADC as the sensor so that value of
> voltage on ADC terminal can be displayed on java applet of oscilloscope. The
> 'TESTMAX136' is using ADC as a sensor. Can anyone tell me how to change the
> sensor being used by oscilloscope from PMIC to ADC.
> 
> Thanks for your time !
> 
> Waqas

-- 

Roger Larsson, Research Engineer
Division of Mobile Networking and Computing
LuleƄ University of Technology 
SE-931 87 SkellefteƄ 
Phone: +46 (0)910 58 53 18

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to