📄 sensing - tinyos documentation wiki.htm
字号:
interface Receive;
interface Timer;
interface Read;
interface Leds;
}
}
</PRE>
<P><CODE>Oscilloscope</CODE> is a combination of different building blocks
introduced in previous parts of the tutorial. Like [Sensing$The Sense
Application|<CODE>Sense</CODE>], <CODE>Oscilloscope</CODE> uses
<CODE>DemoSensorC</CODE> and a timer to periodically sample the default sensor
of a platform. When it has gathered 10 sensor readings
<CODE>OscilloscopeC</CODE> puts them into a message and broadcasts that message
via the <CODE>AMSend</CODE> interface. <CODE>OscilloscopeC</CODE> uses the
<CODE>Receive</CODE> interface for synchronization purposes (see below) and the
<CODE>SplitControl</CODE> interface, to switch the radio on. If you want to know
more about mote-mote radio communication read [Mote-mote radio
communication|lesson 3]. </P><A name=Running_the_Oscilloscope_application></A>
<H2><SPAN class=mw-headline>Running the Oscilloscope application</SPAN></H2>
<P>To install the <CODE>Oscilloscope</CODE> application go to
<CODE>tinyos-2.x/apps/Oscilloscope</CODE> and depending on which hardware you
have, type something similar to <CODE>make telosb install,1</CODE>. Note the
"<CODE>,1</CODE>" after the <CODE>install</CODE> option, which assigns ID 1 to
the node. Assigning IDs to nodes is helpful to differentiate them later on in
the GUI, so make sure you assign different IDs to all nodes on which
<CODE>Oscilloscope</CODE> is installed (e.g. install <CODE>Oscilloscope</CODE>
on a second node with <CODE>make telosb install,2</CODE> and so on). A node
running <CODE>Oscilloscope</CODE> will toggle its second LED for every message
it has sent and it will toggle its third LED when it has received an
<CODE>Oscilloscope</CODE> message from another node: incoming messages are used
for sequence number synchronization to let nodes catch up when they are switched
on later than the others; they are also used for changing the sample rate that
defines how often sensor values are read. In case of a problem with the radio
connection the first LED will toggle. </P>
<P>Install <CODE>BaseStation</CODE> on another node and connect it to your PC.
As usual, on the <CODE>BaseStation</CODE> node you should see the second LED
toggle for every message bridged from radio to serial. </P><A
name=Running_the_Java_GUI></A>
<H2><SPAN class=mw-headline>Running the Java GUI</SPAN></H2>
<P>To visualize the sensor readings on your PC first go to
<CODE>tinyos-2.x/apps/Oscilloscope/java</CODE> and type <CODE>make</CODE>. This
creates/compiles the necessary message classes and the <CODE>Oscilloscope</CODE>
Java GUI. Now start a SerialForwarder and make sure it connects to the node on
which you have installed the <CODE>BaseStation</CODE> application (how this is
done is explained in the <A
title="Mote-PC serial communication and SerialForwarder"
href="http://docs.tinyos.net/index.php/Mote-PC_serial_communication_and_SerialForwarder">previous
lesson</A>). In case you have problems with the Java compilation or the serial
connection work through the <A
title="Mote-PC serial communication and SerialForwarder"
href="http://docs.tinyos.net/index.php/Mote-PC_serial_communication_and_SerialForwarder">previous
lesson</A>. </P>
<P>Once you have a SerialForwarder running you can start the GUI by typing
<CODE>./run</CODE> (in <CODE>tinyos-2.x/apps/Oscilloscope/java</CODE>). You
should see a window similar to the one below: </P>
<CENTER><A class=image title=Image:oscilloscope.jpg
href="http://docs.tinyos.net/index.php/Image:Oscilloscope.jpg"><IMG height=504
alt=Image:oscilloscope.jpg
src="Sensing - TinyOS Documentation Wiki.files/Oscilloscope.jpg" width=610
border=0></A></CENTER>
<P>Each node is represented by a line of different color (you can change the
color by clicking on it in the mote table). The x-axis is the packet counter
number and the y-axis is the sensor reading. To change the sample rate edit the
number in the "sample rate" input box. When you press enter, a message
containing the new rate is created and broadcast via the
<CODE>BaseStation</CODE> node to all nodes in the network. You can clear all
received data on the graphical display by clicking on the "clear data" button.
</P>
<P>The <CODE>Oscilloscope</CODE> (or <CODE>Sense</CODE>) application displays
the raw data as signalled by the <CODE>Read.readDone()</CODE> event. How the
values are to be interpreted is out of scope of the application, but the GUI
let's you adapt the visible portion of the y-axis to a plausible range (at the
bottom right). </P><A name=Related_Documentation></A>
<H1><SPAN class=mw-headline>Related Documentation</SPAN></H1>
<UL>
<LI><A class="external text"
title=http://nescc.sourceforge.net/papers/nesc-ref.pdf
href="http://nescc.sourceforge.net/papers/nesc-ref.pdf" rel=nofollow>nesC
reference manual</A>
<LI><A class="external text"
title=http://www.tinyos.net/tinyos-2.x/doc/html/tep101.html
href="http://www.tinyos.net/tinyos-2.x/doc/html/tep101.html" rel=nofollow>TEP
101: ADC</A>
<LI><A class="external text"
title=http://www.tinyos.net/tinyos-2.x/doc/html/tep114.html
href="http://www.tinyos.net/tinyos-2.x/doc/html/tep114.html" rel=nofollow>TEP
114: SIDs: Source and Sink Independent Drivers</A>
<LI><A class="external text"
title=http://csl.stanford.edu/~pal/pubs/tinyos-programming-1-0.pdf
href="http://csl.stanford.edu/~pal/pubs/tinyos-programming-1-0.pdf"
rel=nofollow>TinyOS Programming Guide</A> </LI></UL>
<HR>
<CENTER>
<P>< <B><A title="Mote-PC serial communication and SerialForwarder"
href="http://docs.tinyos.net/index.php/Mote-PC_serial_communication_and_SerialForwarder">Previous
Lesson</A></B> | <B><A title=Sensing
href="http://docs.tinyos.net/index.php/Sensing#Introduction">Top</A></B> | <B><A
title="Boot Sequence" href="http://docs.tinyos.net/index.php/Boot_Sequence">Next
Lesson</A> ></B> </P></CENTER><!-- Saved in parser cache with key tinyosdocs:pcache:idhash:11-0!1!0!!en!2!edit=0 and timestamp 20080401101641 -->
<DIV class=printfooter>Retrieved from "<A
href="http://docs.tinyos.net/index.php/Sensing">http://docs.tinyos.net/index.php/Sensing</A>"</DIV><!-- end content -->
<DIV class=visualClear></DIV></DIV></DIV></DIV>
<DIV id=column-one>
<DIV class=portlet id=p-cactions>
<H5>Views</H5>
<DIV class=pBody>
<UL>
<LI class=selected id=ca-nstab-main><A title="View the content page [c]"
accessKey=c href="http://docs.tinyos.net/index.php/Sensing">Article</A>
<LI class=new id=ca-talk><A title="Discussion about the content page [t]"
accessKey=t
href="http://docs.tinyos.net/index.php?title=Talk:Sensing&action=edit">Discussion</A>
<LI id=ca-viewsource><A
title="This page is protected. You can view its source. [e]" accessKey=e
href="http://docs.tinyos.net/index.php?title=Sensing&action=edit">View
source</A>
<LI id=ca-history><A title="Past versions of this page. [h]" accessKey=h
href="http://docs.tinyos.net/index.php?title=Sensing&action=history">History</A>
</LI></UL></DIV></DIV>
<DIV class=portlet id=p-personal>
<H5>Personal tools</H5>
<DIV class=pBody>
<UL>
<LI id=pt-login><A
title="You are encouraged to log in, it is not mandatory however. [o]"
accessKey=o
href="http://docs.tinyos.net/index.php?title=Special:Userlogin&returnto=Sensing">Log
in / create account</A> </LI></UL></DIV></DIV>
<DIV class=portlet id=p-logo><A title="Visit the Main Page [z]"
style="BACKGROUND-IMAGE: url(/images/tos-jwall-small.jpg)" accessKey=z
href="http://docs.tinyos.net/index.php/Main_Page"></A></DIV>
<SCRIPT type=text/javascript> if (window.isMSIE55) fixalpha(); </SCRIPT>
<DIV class=portlet id=p-navigation>
<H5>Navigation</H5>
<DIV class=pBody>
<UL>
<LI id=n-mainpage><A title="Visit the Main Page [z]" accessKey=z
href="http://docs.tinyos.net/index.php/Main_Page">Main Page</A>
<LI id=n-portal><A
title="About the project, what you can do, where to find things"
href="http://docs.tinyos.net/index.php/TinyOS_Documentation_Wiki:Community_Portal">Community
portal</A>
<LI id=n-currentevents><A
title="Find background information on current events"
href="http://docs.tinyos.net/index.php/Current_events">Current events</A>
<LI id=n-recentchanges><A title="The list of recent changes in the wiki. [r]"
accessKey=r
href="http://docs.tinyos.net/index.php/Special:Recentchanges">Recent
changes</A>
<LI id=n-randompage><A title="Load a random page [x]" accessKey=x
href="http://docs.tinyos.net/index.php/Special:Random">Random page</A>
<LI id=n-help><A title="The place to find out."
href="http://docs.tinyos.net/index.php/Help:Contents">Help</A>
<LI id=n-sitesupport><A title="Support us"
href="http://docs.tinyos.net/index.php/TinyOS_Documentation_Wiki:Site_support">Donations</A>
</LI></UL></DIV></DIV>
<DIV class=portlet id=p-search>
<H5><LABEL for=searchInput>Search</LABEL></H5>
<DIV class=pBody id=searchBody>
<FORM id=searchform action=/index.php/Special:Search>
<DIV><INPUT id=searchInput title="Search TinyOS Documentation Wiki [f]"
accessKey=f name=search> <INPUT class=searchButton id=searchGoButton type=submit value=Go name=go> <INPUT class=searchButton id=mw-searchButton type=submit value=Search name=fulltext>
</DIV></FORM></DIV></DIV>
<DIV class=portlet id=p-tb>
<H5>Toolbox</H5>
<DIV class=pBody>
<UL>
<LI id=t-whatlinkshere><A title="List of all wiki pages that link here [j]"
accessKey=j
href="http://docs.tinyos.net/index.php/Special:Whatlinkshere/Sensing">What
links here</A>
<LI id=t-recentchangeslinked><A
title="Recent changes in pages linked from this page [k]" accessKey=k
href="http://docs.tinyos.net/index.php/Special:Recentchangeslinked/Sensing">Related
changes</A>
<LI id=t-upload><A title="Upload images or media files [u]" accessKey=u
href="http://docs.tinyos.net/index.php/Special:Upload">Upload file</A>
<LI id=t-specialpages><A title="List of all special pages [q]" accessKey=q
href="http://docs.tinyos.net/index.php/Special:Specialpages">Special pages</A>
<LI id=t-print><A title="Printable version of this page [p]" accessKey=p
href="http://docs.tinyos.net/index.php?title=Sensing&printable=yes">Printable
version</A>
<LI id=t-permalink><A title="Permanent link to this version of the page"
href="http://docs.tinyos.net/index.php?title=Sensing&oldid=260">Permanent
link</A> </LI></UL></DIV></DIV></DIV><!-- end of the left (by default at least) column -->
<DIV class=visualClear></DIV>
<DIV id=footer>
<DIV id=f-poweredbyico><A href="http://www.mediawiki.org/"><IMG
alt="Powered by MediaWiki"
src="Sensing - TinyOS Documentation Wiki.files/poweredby_mediawiki_88x31.png"></A></DIV>
<UL id=f-list>
<LI id=lastmod>This page was last modified 00:52, 28 December 2007.
<LI id=viewcount>This page has been accessed 938 times.
<LI id=privacy><A title="TinyOS Documentation Wiki:Privacy policy"
href="http://docs.tinyos.net/index.php/TinyOS_Documentation_Wiki:Privacy_policy">Privacy
policy</A>
<LI id=about><A title="TinyOS Documentation Wiki:About"
href="http://docs.tinyos.net/index.php/TinyOS_Documentation_Wiki:About">About
TinyOS Documentation Wiki</A>
<LI id=disclaimer><A title="TinyOS Documentation Wiki:General disclaimer"
href="http://docs.tinyos.net/index.php/TinyOS_Documentation_Wiki:General_disclaimer">Disclaimers</A>
</LI></UL></DIV>
<SCRIPT type=text/javascript>if (window.runOnloadHook) runOnloadHook();</SCRIPT>
</DIV><!-- Served in 0.295 secs. --></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -