--- /dev/null
+#include <contiki.h>
+#include <leds.h>
+//#include <stdio.h>
+#include <dev/button-sensor.h>
+
+PROCESS(ledbuttontest, "LED button test");
+AUTOSTART_PROCESSES(&ledbuttontest);
+
+PROCESS_THREAD(ledbuttontest, ev, data) {
+ PROCESS_BEGIN();
+
+ leds_init();
+ leds_off(LEDS_ALL);
+
+ SENSORS_ACTIVATE(button_sensor);
+
+ static char i;
+ static struct etimer timer;
+ for(i = 0; 1; i++) {
+ PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event && data == &button_sensor);
+
+ // debounce for 250 ms
+ etimer_set(&timer, CLOCK_SECOND * 0.25);
+ PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&timer));
+
+ if((i % 2)) {
+ leds_toggle(LEDS_GREEN);
+ }
+ leds_toggle(LEDS_YELLOW);
+ //printf("toggled\n");
+ }
+
+ PROCESS_END();
+}