 
   unsigned int sensor_count = 0;
   // Create analog temperature sensor
-  TemperatureSensor analog_sensor = default_sensor;
-  analog_sensor.address = 0;
-  analog_sensor.type = TYPE_ANALOG;
+  TemperatureSensor analog_sensor;
+  create_sensor(sensor_count, ANALOG_PIN, TYPE_ANALOG, &analog_sensor);
   sensors[sensor_count++] = analog_sensor;
 }
 


#include <Wire.h>
#include <ros.h>
#include <std_msgs/Float32.h>

#define SENSOR_COUNT 1
#define TYPE_ANALOG 0

#define MAX_SAMPLE_RATE 10
#define MAX_SAMPLE_COUNT 10
#define MAX_DELTA 0.5

typedef struct temperature_sensor {
  float prev_temp;
  float curr_temp;
  unsigned int type;

static void handle_temp(TemperatureSensor* sensor) {
  if(abs(sensor->prev_temp - sensor->curr_temp) > MAX_DELTA) {
    sensor->prev_temp = sensor->curr_temp;
    String message = json_prefix + sensor->id + json_middle + sensor->curr_temp + json_suffix;
    temp_msg.data = message.c_str();
    pub_temp.publish(&temp_msg);
  }
}
