50 #include "contiki-net.h"
51 #include "dev/temperature-sensor.h"
52 #include "dev/acc-sensor.h"
55 PROCESS(shell_sensors_process,
"sensors");
58 "sensors {temp|acc}: get sensor value",
59 &shell_sensors_process);
70 "sensors {temp|acc}: a sensor must be specified",
"");
74 if(strcmp(data,
"temp")==0) {
78 snprintf(str_buf,
sizeof(str_buf),
"%d.%d degC",temp/10,temp-(temp/10)*10);
83 else if (strcmp(data,
"acc")==0) {
85 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));
95 shell_sensors_init(
void)
97 SENSORS_ACTIVATE(acc_sensor);
void shell_output_str(struct shell_command *c, char *text1, const char *text2)
Output strings from a shell command.
struct sensors_sensor temperature_sensor
NOTE: For the temperature measurement, the ADC extended range mode is needed; but this is inaccurate ...
#define PROCESS_EXIT()
Exit the currently running process.
#define PROCESS_BEGIN()
Define the beginning of a process.
Main header file for the Contiki shell
#define NULL
The null pointer.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
#define PROCESS_END()
Define the end of a process.
void shell_register_command(struct shell_command *c)
Register a command with the shell.
#define PROCESS(name, strname)
Declare a process.
#define SHELL_COMMAND(name, command, description, process)
Define a shell command.