46 #include "contiki-net.h"
47 #include "dev/temperature-sensor.h"
48 #include "dev/acc-sensor.h"
51 PROCESS(shell_sensors_process,
"sensors");
52 SHELL_COMMAND(sensors_command,
54 "sensors {temp|acc}: get sensor value",
55 &shell_sensors_process);
65 shell_output_str(&sensors_command,
66 "sensors {temp|acc}: a sensor must be specified",
"");
70 if(strcmp(data,
"temp")==0) {
72 unsigned int temp = temperature_sensor.value(0);
74 snprintf(str_buf,
sizeof(str_buf),
"%d.%d degC",temp/10,temp-(temp/10)*10);
76 shell_output_str(&sensors_command,
"Temp: ", str_buf);
79 else if (strcmp(data,
"acc")==0) {
81 snprintf(str_buf,
sizeof(str_buf),
"%d,%d,%d) mg",acc_sensor.value(ACC_X_AXIS),acc_sensor.value(ACC_Y_AXIS),acc_sensor.value(ACC_Z_AXIS));
83 shell_output_str(&sensors_command,
"(X,Y,Z): (", str_buf);
91 shell_sensors_init(
void)
93 SENSORS_ACTIVATE(acc_sensor);
95 shell_register_command(&sensors_command);