WSN-Praktikum WS2011/12, first application: binary LED counter
authorRoland Hieber <rohieb@rohieb.name>
Sat, 29 Oct 2011 17:29:51 +0000 (19:29 +0200)
committerRoland Hieber <rohieb@rohieb.name>
Sat, 29 Oct 2011 17:29:51 +0000 (19:29 +0200)
Makefile.example [new file with mode: 0644]
Makefile.properties.example [new file with mode: 0644]
tutorial/ledtest/Makefile [new file with mode: 0644]
tutorial/ledtest/ledtest.c [new file with mode: 0644]

diff --git a/Makefile.example b/Makefile.example
new file mode 100644 (file)
index 0000000..4376160
--- /dev/null
@@ -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 (file)
index 0000000..91ca657
--- /dev/null
@@ -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 (file)
index 0000000..0869848
--- /dev/null
@@ -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 (file)
index 0000000..4d96646
--- /dev/null
@@ -0,0 +1,28 @@
+#include <contiki.h>
+#include <leds.h>
+#include <stdio.h>
+
+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();
+}
This page took 0.054923 seconds and 4 git commands to generate.