Difference between revisions of "Tutorial:ZigBee"
(Version 1.0) |
|||
Line 18: | Line 18: | ||
1 Configuration file, SimpleAppC.nc | 1. Configuration file, SimpleAppC.nc | ||
<nowiki> | <nowiki> | ||
configuration SimpleAppC{ | configuration SimpleAppC{ | ||
Line 31: | Line 31: | ||
2 SimpleC. | 2. SimpleC.nc | ||
<nowiki>module SimpleC{ | <nowiki>module SimpleC{ | ||
Line 41: | Line 41: | ||
} | } | ||
}</nowiki> | }</nowiki> | ||
When system starts, it will call interface booted in <code>MainC</code>, but this interface is not implemented. | When system starts, it will call interface booted in <code>MainC</code>, but this interface is not implemented. | ||
Line 55: | Line 54: | ||
3 Makefile | 3. Makefile | ||
<nowiki> | <nowiki> | ||
COMPONENT=SimpleAppC | COMPONENT=SimpleAppC | ||
Line 63: | Line 62: | ||
<nowiki>make telosb</nowiki> | <nowiki>make telosb</nowiki> | ||
4 install | |||
4. install | |||
To install program to telosb node | To install program to telosb node | ||
<nowiki>make telosb install bsl,/dev/ttyUSB0</nowiki> | <nowiki>make telosb install bsl,/dev/ttyUSB0</nowiki> |
Revision as of 20:00, 24 September 2019
This page shows the tutorial for experiments with ZigBee communications and the testbed.
Useful links:
- TinyOS intro (Chinese)
- Programming model of TinyOS (Chinese)
- TinyOS main site and official tutorials
The simplest example
This example shows
1) how the event-driven programming works,
2) how to burn a program to a TelosB node.
for details you can see simplest tinyos program
1. Configuration file, SimpleAppC.nc
configuration SimpleAppC{ } implementation{ components SimpleC, MainC; SimpleC.Boot -> MainC.Boot; }
this file will link two components SimpleC
and MainC
2. SimpleC.nc
module SimpleC{ uses interface Boot; } implementation{ event void Boot.booted() { } }
When system starts, it will call interface booted in MainC
, but this interface is not implemented.
So SimpleC
implements it.
MainC
in nesC is just like main function in C.
In this example, it does nothing, so it just like following code in C:
int main () { return 0; }
3. Makefile
COMPONENT=SimpleAppC include $(MAKERULES)
with Makefile
we can compile the code by typing
make telosb
4. install
To install program to telosb node
make telosb install bsl,/dev/ttyUSB0
Measurement
To measure various information from received packets.
Code template
Extract info upon receiving a packet.