Tutorial: ZigBee
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 is 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.