Lesson 01 slides for one day introductory course on wireless sensor networks and TinyOS, that took place at the University of Alcalá de Henares in Madrid Spain the 18th of September 2013. This course was jointly designed by the Electronics Department of the university and Advanticsys. Find source code for the lessons here: http://www.advanticsys.com/wiki/index.php?title=TinyOS%C2%AE_Course_at_UAH_18th_September_2013
2. • Introduction to nesC
• Components
• FileTypes
• Basic program: NullC
• How to compile
• NesC variables
• Eclipse IDE
• Exercises
2
Contents
3. • A nesC application consists of one or more components assembled, or
wired, to form an application executable.
• Components define two scopes:
• one for their specification which contains the names of their
interfaces, and
• a second scope for their implementation.
COMPONENT A
SPECIFICATION
IMPLEMENTATION
3
NesC (I)
4. •A component provides and uses interfaces.
•The provided interfaces are intended to represent the
functionality that the component provides to its user in its
specification.
•The used interfaces represent the functionality the component
needs to perform its job in its implementation.
4
NesC (II)
5. • Interfaces are bidirectional: they specify a set of commands, which
are functions to be implemented by the interface's provider, and a set
of events, which are functions to be implemented by the interface's
user. For a component to call the commands in an interface, it must
implement the events of that interface.
•The set of interfaces which a component provides together with the
set of interfaces that a component uses is considered that
component's signature.
5
NesC (III)
6. •There are 2 types of components in nesC:
- Modules: provide the implementations of one or more
interfaces.
- Configurations: used to assemble other components together,
connecting interfaces used by components to interfaces provided
by others.
6
Components
7. • Naming conventions are as follows:
CONFIGURATIO
N
MODULE
COMPONENTS
INTERFACE
Makefile Only in main app
7
File Types
CONFIGURATION
MODULE
10. • Open terminal in the folder
•Type:
make telosb
• Insert mote in USB port and type:
make telosb reinstall.1 bsl,/dev/ttyUSB0
Platform
MoteID USB port (type motelist
to find which one it is
10
How to compile
11. • Open terminal in the folder
• Type:
make telosb docs
• Check the created folders
Platform
11
Fun Stuff
12. • Commonly used units:
• int is NOT used
• bool is also used
12
NesC variables
13. • An alternative to console programming is using a TinyOS plug-in
for the Eclipse IDE.
• In this IDE it is possible to compile and install programs in motes
•We will use this IDE to speed up the lessons.
13
Eclipse IDE
14. 1. Interface Leds has commands to control the 3 leds on the mote.
(led0, led1, led2).Try each of them and install them on the mote
2. Add a Timer to blink the Leds periodically, showing a binary timer
using the 3 leds.
3. Configure the User Button to do a complete routine with the Leds
4. Pack the previous subroutine in a new component with your own
interface.
14
Exercises