sivateja10

Led.c

Nov 19th, 2020
264
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "contiki.h"
  2. #include<stdio.h>
  3. #include "dev/leds.h"
  4.  
  5. #include "dev/button-sensor.h"
  6.  
  7. PROCESS(led_process, "LED process");
  8.  
  9. AUTOSTART PROCESS(&led_process);
  10.  
  11. PROCESS_THREAD(led_process,ev,data)
  12. {
  13. PROCESS_BEDIN();
  14. SENSOR_ACTIVATE(button-sensor);
  15.  
  16. while(1)
  17. {
  18.   printf("Press button Sensor\n");
  19.   PROCESS_WAIT_EVENT_UNTIL(ev=sensors_event && data = button_sensor);
  20.   leds_toggle(LEDS_GREEN);
  21. printf("Sensor value is %u",leds_get());
  22.  
  23. PROCESS_END();
  24. }
  25.  
  26.  
  27.  
RAW Paste Data