Created
April 24, 2015 03:34
-
-
Save rehrumesh/677ae4ccec74b96feef1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "contiki.h" | |
#include "dev/button-sensor.h" | |
#include <stdio.h> | |
PROCESS(blink_process, "Blink"); | |
AUTOSTART_PROCESSES(&blink_process); | |
PROCESS_THREAD(blink_process,ev,data){ | |
PROCESS_BEGIN(); | |
SENSORS_ACTIVATE(button_sensor); | |
static int value = 0; | |
while(1){ | |
PROCESS_WAIT_EVENT(); | |
if(ev == sensors_event && data == &button_sensor){ | |
printf("Button press event :\n"); | |
value = value +1; | |
} | |
printf("after an event \n"); | |
printf("value=%d\n", value); | |
} | |
PROCESS_END(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment