README-EXAMPLES.md 6.18 KB
Newer Older
Rémy Léone's avatar
Rémy Léone committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Contiki Examples
================

The examples/ directory contains a few examples that will help you get
started with Contiki.

To run the example programs, you need either to be running Linux or FreeBSD (or
any other UNIX-type system), or install Cygwin if you are running Microsoft
Windows [http://cygwin.com](http://cygwin.com). As a minimum you will need to
have the gcc C compiler installed. To run the examples in the 'netsim' target,
you need to have GTK 1.x development libraries installed. These are usually
called 'gtk-devel', 'libgtk1-devel' or similar in your Linux software
installation programs.

compile-platforms/
------------------

A test script that compiles Contiki for a number of platforms and reports any
errors found during the build.

email/
------

An email program supporting SMTP. It can be compiled and run in the 'win32'
target by typing the following commands:

    cd examples/email
    make
    ./email-client.win32

Most likely you'll have to adjust the TCP/IP values set in main() in
platform/win32/contiki-main.c to match your needs.

34
Please consult cpu/native/net/README-WPCAP.md as well.
Rémy Léone's avatar
Rémy Léone committed
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

esb/
----

A set of demo applications for the ESB board.

ftp/
----

An FTP client supporting download. It can be compiled and run in the 'win32'
target by typing the following commands:

    cd examples/ftp
    make
    ./ftp-client.win32

Most likely you'll have to adjust the TCP/IP values set in main() in
platform/win32/contiki-main.c to match your needs.

54
Please consult cpu/native/net/README-WPCAP.md as well.
Rémy Léone's avatar
Rémy Léone committed
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

hello-world/
------------

A really simple Contiki program that shows how to write Contiki programs. To
compile and test the program, go into the hello-world directory:

    cd examples/hello-world

Run the 'make' command.

    make

This will compile the hello-world program in the 'native' target.  This causes
the entire Contiki operating system and the hello-world application to be
compiled into a single program that can be run by typing the following command:

    ./hello-world.native

This will print out the following text:

    Contiki initiated, now starting process scheduling
    Hello, world

The program will then appear to hang, and must be stopped by pressing the C key
while holding down the Control key.

irc/
----

An IRC client. It can be compiled and run in the 'win32' target by
typing the following commands:

    cd examples/irc
    make
    ./irc-client.win32

Most likely you'll have to adjust the TCP/IP values set in main() in
platform/win32/contiki-main.c to match your needs.

95
Please consult cpu/native/net/README-WPCAP.md as well.
Rémy Léone's avatar
Rémy Léone committed
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161

multi-threading/
----------------

A quite simple demonstration of the Contiki multi-threading library
employing two worker threads each running a recursive function. It
can be compiled and run in the 'native' target by typing the
following commands:

    cd examples/multi-threading
    make
    ./multi-threading.native

rime/
-----

Contains a set of examples on how to use the Rime communications
stack. To run those examples in the 'netsim' target (a very simple
Contiki network simulator), compile the programs with:

    make TARGET=netsim

You will need to have GTK 1.x development libraries installed.

Run the different programs:

    ./test-abc.netsim
    ./test-meshroute.netsim
    ./test-rudolph0.netsim
    ./test-rudolph1.netsim
    ./test-treeroute.netsim
    ./test-trickle.netsim

Most of the examples requires you to click with the middle mouse
button on one of the simulated nodes for something to happen.

sky/
----

Examples inteded for running on the Tmote Sky board. To compile those, you need
to have msp430-gcc (the gcc C compiler for the MSP430 microcontroller)
installed.

The follwing programs are included:

- blink.c          A simple program that blinks the on-board LEDs
- sky-collect.c    Collects sensor data and energy profile values to a sink.
  Press the "user" button on the Tmote Sky that is connected to the PC to make
  the node a sink.
- test-button.c    Toggles the LEDs when the button is pressed.
- test-cfs.c       Tests the 1 mb flash memory of the Tmote Sky

telnet-server/
--------------

A simple TCP telnet server with a simple command shell. It can be
compiled and run in the 'minimal-net' target by typing the following
commands:

    cd examples/telnet-server
    make
    ./telnet-server.minimal-net

Most likely you'll have to adjust the TCP/IP values set in main() in
platform/minimal-net/contiki-main.c to match your needs.

162
Please consult cpu/native/net/README-WPCAP.md as well if you are running
Rémy Léone's avatar
Rémy Léone committed
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
Microsoft Windows.

webbrowser/
-----------

A text mode web browser supporting links and forms. It can be compiled
and run in the 'win32' target by typing the following commands:

    cd examples/webbrowser
    make
    ./webbrowser.win32

Most likely you'll have to adjust the TCP/IP values set in main() in
platform/win32/contiki-main.c to match your needs.

178
Please consult cpu/native/net/README-WPCAP.md as well.
Rémy Léone's avatar
Rémy Léone committed
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201

webserver/
----------

A web server supporting dynamic content creation using "scripts" which
are actually compiled-in C-functions. It can be compiled and run in the
'minimal-net' target by typing the following commands:

    cd examples/webserver
    make
    ./webserver-example.minimal-net

As an alternative to the static and dynamic compiled-in content the web
server can instead support "external" static-only content loaded from
any storage supported by the 'Contiki File System' (CFS) interface. To
compile it in the 'minimal-net' target and have it load files from disk
use the following command:

    make HTTPD-CFS=1

Most likely you'll have to adjust the TCP/IP values set in main() in
platform/minimal-net/contiki-main.c to match your needs.

202
Please consult cpu/native/net/README-WPCAP.md as well if you are running
Rémy Léone's avatar
Rémy Léone committed
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
Microsoft Windows.

wget/
-----

A command line program that retrieves files from web servers and saves them
using the 'Contiki File System' (CFS). It can be compiled and run in the
'minimal-net' target by typing the following commands:

    cd examples/wget
    make
    ./wget.minimal-net

Most likely you'll have to adjust the TCP/IP values set in main() in
platform/minimal-net/contiki-main.c to match your needs.

219
Please consult cpu/native/net/README-WPCAP.md as well if you are running
Rémy Léone's avatar
Rémy Léone committed
220
Microsoft Windows.