From 0d2c500d5f41640cab98d352b1c2c0a11e58cb34 Mon Sep 17 00:00:00 2001 From: Roland Hieber Date: Sat, 29 Oct 2011 19:29:51 +0200 Subject: [PATCH] WSN-Praktikum WS2011/12, first application: binary LED counter --- Makefile.example | 12 ++++++++++++ Makefile.properties.example | 7 +++++++ tutorial/ledtest/Makefile | 7 +++++++ tutorial/ledtest/ledtest.c | 28 ++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+) create mode 100644 Makefile.example create mode 100644 Makefile.properties.example create mode 100644 tutorial/ledtest/Makefile create mode 100644 tutorial/ledtest/ledtest.c diff --git a/Makefile.example b/Makefile.example new file mode 100644 index 0000000..4376160 --- /dev/null +++ b/Makefile.example @@ -0,0 +1,12 @@ +# example Makefile for your project + +# change this to the path to your Makefile.properties +# (see Makefile.properties.example for a template) +include Makefile.properties + +CONTIKI_PROJECT=yourproject + +all: $(CONTIKI_PROJECT) + +include $(CONTIKI)/Makefile.include + diff --git a/Makefile.properties.example b/Makefile.properties.example new file mode 100644 index 0000000..91ca657 --- /dev/null +++ b/Makefile.properties.example @@ -0,0 +1,7 @@ +# Rename or copy file this to Makefile.properties + +# Path to your contiki-inga installation +# for example, git clone from git://git.ibr.cs.tu-bs.de/contiki-inga.git +CONTIKI=/home/rohieb/Projects/contiki-inga.git +TARGET=inga + diff --git a/tutorial/ledtest/Makefile b/tutorial/ledtest/Makefile new file mode 100644 index 0000000..0869848 --- /dev/null +++ b/tutorial/ledtest/Makefile @@ -0,0 +1,7 @@ +include ../../Makefile.properties +CONTIKI_PROJECT=ledtest + +all: $(CONTIKI_PROJECT) + +include $(CONTIKI)/Makefile.include + diff --git a/tutorial/ledtest/ledtest.c b/tutorial/ledtest/ledtest.c new file mode 100644 index 0000000..4d96646 --- /dev/null +++ b/tutorial/ledtest/ledtest.c @@ -0,0 +1,28 @@ +#include +#include +#include + +PROCESS(ledtest, "LED test"); +AUTOSTART_PROCESSES(&ledtest); + +PROCESS_THREAD(ledtest, ev, data) { + PROCESS_BEGIN(); + + leds_init(); + leds_off(LEDS_ALL); + + static struct etimer led_timer; + static char i; + for(i = 0; 1; i++) { + etimer_set(&led_timer, CLOCK_SECOND); + + if((i % 2)) { + leds_toggle(LEDS_GREEN); + } + leds_toggle(LEDS_YELLOW); + + PROCESS_WAIT_EVENT(); + } + + PROCESS_END(); +} -- 2.20.1