1 2 3 4 5
| #ifndef MYSENSOR_H #define MYSENSOR_H
#endif
|
1 2 3 4
| #include "**.h" #include <stdlib.h> ...
|
Replace the <name> segments to an user-defined name.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| #include "**.h" #include "contiki.h" #include "shell.h" #include "lib/list.h" #include "sys/etimer.h" #include "serial-shell.h" #include "collect-view.h"
#include <math.h> #include <stdio.h> #include <ctype.h> #include <string.h>
PROCESS(<name>_process, "<name>"); AUTOSTART PROCESSES(&<name>_process);
static struct etimer timer; PROCESS THREAD(sensor_process, ev, data) { PROCESS BEGIN(); printf("Process <name> starts.\n"); while(1) { etimer_set(&timer, CLOCK_SECOND); PROCESS WAIT EVENT UNTIL(etimer_expired(etimer)); doSomethingHere(); printf("------------<Name>------------\n."); } PROCESS END(); }
|
1 2 3 4 5 6 7
| CONTIKI PROJECT = demo-sensor all: $(CONTIKI_PROJECT) PROJECT SOURCEFILES += **.c MODULES += os/services/shell
CONTIKI = /home/user/Documents/book/contiki include $(CONTIKI)/Makefile.include
|