added button sensing and leds-blinking for better sensor demo
This commit is contained in:
parent
131e922020
commit
1d447dc043
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* @(#)$Id: sensor-output.c,v 1.2 2007/03/28 11:04:07 nifi Exp $
|
||||
* @(#)$Id: sensor-output.c,v 1.3 2007/10/26 12:37:48 joxe Exp $
|
||||
*/
|
||||
#include "contiki-esb.h"
|
||||
|
||||
|
@ -46,6 +46,7 @@ PROCESS_THREAD(sensor_output_process, ev, data)
|
|||
PROCESS_BEGIN();
|
||||
|
||||
/* Activate some sensors to get sensor events */
|
||||
button_sensor.activate();
|
||||
pir_sensor.activate();
|
||||
vib_sensor.activate();
|
||||
|
||||
|
@ -53,8 +54,11 @@ PROCESS_THREAD(sensor_output_process, ev, data)
|
|||
PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event);
|
||||
|
||||
s = (struct sensors_sensor *)data;
|
||||
|
||||
printf("%s %d\n", s->type, s->value(0));
|
||||
|
||||
if (data == &button_sensor) leds_invert(LEDS_YELLOW);
|
||||
if (data == &pir_sensor) leds_invert(LEDS_GREEN);
|
||||
if (data == &vib_sensor) leds_invert(LEDS_RED);
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
|
|
Loading…
Reference in a new issue