Skip to content

Instantly share code, notes, and snippets.

@rehrumesh
Created April 24, 2015 03:34
Show Gist options
  • Save rehrumesh/677ae4ccec74b96feef1 to your computer and use it in GitHub Desktop.
Save rehrumesh/677ae4ccec74b96feef1 to your computer and use it in GitHub Desktop.
#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