12 float floor2(
float x){
13 if(x>=0.0f)
return (
float) ((int)x);
14 else return (
float) ((int)x-1);
17 PROCESS(do_nothing_process,
"Process that does nothing");
19 AUTOSTART_PROCESSES(&do_nothing_process);
22 static struct etimer sample_timer;
31 ms_get_batt(&bat_val);
32 float voltage = bat_val;
34 float f1 = bat_val/1698;
37 int d2 = trunc(f2 * 10000);
40 printf(
"Batv Value: %f\n", bat_val);
42 printf(
"Batv Value: %d.%d\n", d1, d2);
44 printf(
"Approx Voltage: %ld.%02d\n\n", (
long)voltage, (
int)((voltage - floor2(voltage))*100) );
void etimer_set(struct etimer *et, clock_time_t interval)
Set an event timer.
#define PROCESS_END()
Define the end of a process.
#define PROCESS(name, strname)
Declare a process.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
#define CLOCK_SECOND
A second, measured in system clock time.
#define PROCESS_WAIT_EVENT()
Wait for an event to be posted to the process.
#define PROCESS_BEGIN()
Define the beginning of a process.