contiki/examples/z1/test-battery.c
Enric M. Calvo 659f36eb79 Updated *-sensor.c files from the sky platform.
Fixed battery-sensor plus added simple test (XXX)
2011-02-25 15:35:41 +01:00

33 lines
688 B
C

#include "contiki.h"
#include "dev/battery-sensor.h"
#include <stdio.h> /* For printf() */
/*---------------------------------------------------------------------------*/
PROCESS(aplicacio, "Aplicacio de prova");
AUTOSTART_PROCESSES(&aplicacio);
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(aplicacio, ev, data)
{
PROCESS_BEGIN();
SENSORS_ACTIVATE(battery_sensor);
while (1)
{
uint16_t bateria = battery_sensor.value(0);
printf("Battery: %i\n", bateria);
}
SENSORS_DEACTIVATE(battery_sensor);
PROCESS_END();
}
/*---------------------------------------------------------------------------*/