Download presentation
Presentation is loading. Please wait.
Published byEustace Gordon Modified over 9 years ago
1
Lecture 5 Sensing 石致豪
2
Introduction
3
Sense application SenseAppC.nc configuration SenseAppC { } implementation { components SenseC, MainC, LedsC, new TimerMilliC(), new DemoSensorC() as Sensor; SenseC.Boot -> MainC; SenseC.Leds -> LedsC; SenseC.Timer -> TimerMilliC; SenseC.Read -> Sensor; }
4
module SenseC { uses { interface Boot; interface Leds; interface Timer ; interface Read ; }
5
Read interface interface Read { /** * Initiates a read of the value. * * @return SUCCESS if a readDone() event will eventually come back. */ command error_t read(); /** * Signals the completion of the read(). * * @param result SUCCESS if the read() was successful * @param val the value that has been read */ event void readDone( error_t result, val_t val ); }
6
DemoSenserC component generic configuration DemoSensorC() { provides interface Read ; } implementation { components new VoltageC() as DemoSensor; can be modified!! Read = DemoSensor; }
7
Available Sensor component tinyos-2.x/tos/platforms tinyos-2.x/tos/sensorboards tinyos-2.x/tos/chips tinyos-2.x/tos/system
8
Running the Sense application apps/Sense make telosb install
9
Oscilloscope application Let you visualize sensor readings on the PC Broadcasts a message within 10 accumulated readings over the radio Must be used with the BaseStation application
10
OscilloscopeAppC.nc configuration OscilloscopeAppC { } implementation { components OscilloscopeC, MainC, ActiveMessageC,LedsC, new TimerMilliC(), new DemoSensorC() as Sensor, new AMSenderC(AM_OSCILLOSCOPE), new AMReceiverC(AM_OSCILLOSCOPE); OscilloscopeC.Boot -> MainC; OscilloscopeC.RadioControl -> ActiveMessageC; OscilloscopeC.AMSend -> AMSenderC; OscilloscopeC.Receive -> AMReceiverC; OscilloscopeC.Timer -> TimerMilliC; OscilloscopeC.Read -> Sensor; OscilloscopeC.Leds -> LedsC; }
11
OscilloscopeC.nc module OscilloscopeC { uses { interface Boot; interface SplitControl as RadioControl; interface AMSend; interface Receive; interface Timer; interface Read; interface Leds; }
12
Running te Oscilloscope application tinyos-2.x/apps/Oscilloscope $ make telosb install,1 ^ L assign number to node
13
Running the Java GUI Create a BaseStation node tiny-2.x/apps/Oscilloscope/java/% make Create a SerialFowarder./run
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.