From: Roland Hieber Date: Sat, 29 Oct 2011 17:29:51 +0000 (+0200) Subject: WSN-Praktikum WS2011/12, first application: binary LED counter X-Git-Url: https://git.rohieb.name/wsn-p.git/commitdiff_plain/0d2c500d5f41640cab98d352b1c2c0a11e58cb34?ds=sidebyside WSN-Praktikum WS2011/12, first application: binary LED counter --- 0d2c500d5f41640cab98d352b1c2c0a11e58cb34 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(); +}