 
 uint16_t readVcc() {
   // Read 1.1V reference against AVcc
-  // set the reference to Vcc and the measurement to the internal 1.1V reference
-  #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
-    ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
-  #elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
-    ADMUX = _BV(MUX5) | _BV(MUX0);
-  #elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
-    ADMUX = _BV(MUX3) | _BV(MUX2);
-  #else
-    ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
-  #endif  
+  ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
 
   delay(2); // Wait for Vref to settle
   ADCSRA |= _BV(ADSC); // Start conversion

}

void buildPayload() {
  // Switch on DHT22
  pinMode(27, OUTPUT);
  digitalWrite(27, HIGH);

  delay(1);
  DHT.read22(DHT22_PIN);
  digitalWrite(27, LOW);

  temp_c = int16_t(DHT.temperature*100);
  humidity = int16_t(DHT.humidity*100);
  battery = readVcc;


  txBuffer[0] = byte(temp_c>>8);
  txBuffer[1] = byte(temp_c);

void loop() {
  startTime = millis();
  buildPayload();
  // Queue packet for TX
  do_send(&sendjob);
  while(LMIC.opmode & OP_TXRXPEND)
  {
