 }
 
 void printDataArray() {
+    Serial.println("==== Sensor data captured ===");
+
     for (byte i = 0; i < DATA_ARRAY_SIZE; i++) {
         printByteAsBitSet(data[i]);
         Serial.print("|");
     }
     Serial.println();
+
+    byte sensorNumber = data[1] >> 2;
+    byte powerOnUUID = (data[0] << 2) | (data[1] & 3);
+    byte powerState = data[2] >> 3;
+    float temperature = (float)getTemperature() / 10;
+    byte humidity = getHumidity();
+    boolean checkSumMatches = checkSumMatch();
+
+    Serial.print("No: ");
+    Serial.println(sensorNumber);
+
+    Serial.print("Power UUID: ");
+    Serial.println(powerOnUUID);
+
+    Serial.print("Power state: ");
+    Serial.println(powerState == 0 ? "normal" : "low");
+
+    Serial.print("Temperature: ");
+    Serial.println(temperature);
+
+    Serial.print("Humidity: ");
+    Serial.println(humidity);
+
+    Serial.print("CheckSumMatch: ");
+    printByteAsBitSet(checkSumMatch());
+    Serial.println();
 }
 
 void printByteAsBitSet(byte b) {
-    if (b & 8) {
-        Serial.print("1");
-    } else {
-        Serial.print("0");
-    }
-
-    if (b & 4) {
-        Serial.print("1");
-    } else {
-        Serial.print("0");
-    }
-
-    if (b & 2) {
-        Serial.print("1");
-    } else {
-        Serial.print("0");
-    }
-
-    if (b & 1) {
-        Serial.print("1");
-    } else {
-        Serial.print("0");
-    }
+    Serial.print((b & 8) >> 3);
+    Serial.print((b & 4) >> 2);
+    Serial.print((b & 2) >> 1);
+    Serial.print(b & 1);
+}
+
+byte checkSumMatch() {
+
+    //Sum first 8 tetrads
+    int sum = 0;
+    for (byte i = 0; i < DATA_ARRAY_SIZE - 1; i++) {
+        sum += (int)data[i];
+    }
+
+    //returns true if calculated check sum matches received
+    //return getLastFourBitsReversed(sum) == data[DATA_ARRAY_SIZE - 1];
+    return getLastFourBitsReversed(sum);
+}
+
+int getTemperature() {
+    int temperature = 0;
+
+    temperature = (((int)getLastFourBitsReversed(data[5]) << 8)
+                   | ((int)getLastFourBitsReversed(data[4]) << 4)
+                   | (int)getLastFourBitsReversed(data[3]));
+
+    if ((data[5] & 1) == 1) {
+        //negative number, use two's compliment conversion
+        temperature = (~temperature + 1);
+
+        //clear higher bits
+        temperature = temperature & 4096;
+    }
+
+    return temperature;
+}
+
+int getHumidity() {
+
+    //negative number, use two's compliment conversion
+    int humidity = ((int)(getLastFourBitsReversed(data[7]) << 4)
+            | (int)getLastFourBitsReversed(data[6]));
+
+    humidity = ~humidity + 1;
+
+    return 100 - humidity;
 }
 
 void fillDataArray(byte bitNumber, boolean isOne) {

//
// D0-F3 - temperature written backwards and multiplied by 10. For example:
//         1010|0011|0000 = 19.7° (Celsius) because 0000|1100|0101 = 197
//
// G0-H3 - humidity. format is not recognized yet TODO
//
// I0-I3 - 4 less significant bits of check sum of the tetrads T1-T8 written backwards.
//            for example let's look at the example message:

    data[dataArrayIndex] = (data[dataArrayIndex] << 1) | isOne;
}

//reverse last 4 bits and return
//so 0101 -> 1010, 1100 -> 0011
byte getLastFourBitsReversed(int b) {
    byte inverted = 0;

    inverted = inverted | ((b & 1) << 3); //(byte & 0001) << 3 so could be 1000
    inverted = inverted | (b & 2) << 1; //(byte & 0010) << 1 so could be 0100
    inverted = inverted | (b & 4) >> 1; // (byte & 0100) >> 1 so could be 0010
    inverted = inverted | (b & 8) >> 3; // (byte & 1000) >> 3 so could be 0001

    return inverted;
}

// Matcher for divider bit
boolean matchDivider(int value) {
    return match(value, DIVIDER_PULSE_LENGTH, DIVIDER_THRESHOLD);
