     Serial.begin(9600);
   #endif
   
+  // reading sensor id from EEPROM
+  EEPROM.get(EE_SID_ADDR, sensor_id);
   DEBUG_PRINT("Hello, I'm sensor: ");
   DEBUG_PRINTLN(sensor_id);
+
+  // reading smode from EEPROM
+  EEPROM.get(EE_SMODE_ADDR, smode);
+  DEBUG_PRINT("Current sending mode is: ");
+  DEBUG_PRINTLN(smode);
 
   DEBUG_PRINT("Powering sensors from pin ");
   DEBUG_PRINTLN(SENSOR_POWER_PIN);

#define DHTTYPE DHT22                   // DHT 22  (AM2302)
#define SENSOR_POWER_HEATUP_DELAY 500   // wait for power stabilization

char* sensor_id = "Sensor1"; // TODO: this will be later loaded from EEPROM

DHT dht(DHTPIN, DHTTYPE);


  
  vw_set_tx_pin(RFTX_PIN);
  vw_setup(RFTX_RATE);

  // interrupt handler that will be activated when the user presses a button
  attachInterrupt(digitalPinToInterrupt(BUTTON_PIN), on_button_press, RISING);
}

#define MILLISEC  1
#define SECOND    1000 * MILLISEC
#define MINUTE    60 * SECOND
#define HOUR      60 * MINUTE

#define SMODE_COUNT 4
const int smode_delays_ms[SMODE_COUNT] = { 2*SECOND, 1*MINUTE, 10*MINUTE, 1*HOUR };

// disty hack: reset function at address 0
void(* resetFunc) (void) = 0;

/**
 * Interrupt handler for the "smode" button.
 */
void on_button_press() {

  // cycle through sending modes
  smode = (smode + 1) % SMODE_COUNT;

  // write new smode value to EEPROM
  EEPROM.put(EE_SMODE_ADDR, smode);
  
  // now we can reset the device with a new smode value
  resetFunc();
}

void loop() {

  // turn off power from sensors to save battery
  digitalWrite(SENSOR_POWER_PIN, LOW);

  // Wait a few seconds between measurements.
