I want to ask regarding my z1 motes (msp430 device) that was uploaded a program that tests the battery. It shows the values in the picture below.
But I don't know what the values mean. Does this mean that the battery will be empty the closer the value 254x is to 0?
This the code used:
#include "contiki.h"
#include "dev/battery-sensor.h"
#include <stdio.h>
PROCESS(test_battery_process, "Battery Sensor Test");
AUTOSTART_PROCESSES(&test_battery_process);
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(test_battery_process, ev, data)
{
PROCESS_BEGIN();
SENSORS_ACTIVATE(battery_sensor);
while(1) {
uint16_t bateria = battery_sensor.value(0);
float mv = (bateria * 2.500 * 2) / 4096;
printf("Battery: %i (%ld.%03d mV)\n", bateria, (long)mv,
(unsigned)((mv - floor(mv)) * 1000));
}
SENSORS_DEACTIVATE(battery_sensor);
PROCESS_END();
}
Thanks.