HYT humidity & temp sensor polling / showing received data at TFT with capacitive touchscreen

Dependencies:   FT800_2 HYT mbed

HYT humidity & temperature sensor: polling and showing data at TFT via graphical controller FT800/FT801.

Hardware

For documentation on the FT800 library, please refer to the library pages.

Connection

MCU-board to TFT-module

MCU-board is connected to TFT-module via Break Out Board. You need 6 signals to connect: SCK, MOSI and MISO are connected to a SPI channel, SS is the chip select signal, PD work as powerdown and INT for interrupts from TFT to MCU.

/media/uploads/Ksenia/4_-22-.jpg

You have to connect VDD to BLVDD at Break Out Board if you use the board:

/media/uploads/Ksenia/4_-5-.jpg

MCU-board to HYT sensor

MCU-board is connected to sensor via I2C. Remember to use pull-up resisrors there:

/media/uploads/Ksenia/freshpaint-20-2016.09.16-10.37.03.png

Подробнее в статьях Как перестать бояться и полюбить mbed [Часть 1 - 5] на https://habrahabr.ru/users/uuuulala/topics/

Files at this revision

API Documentation at this revision

Comitter:
Ksenia
Date:
Fri Oct 07 11:08:19 2016 +0000
Commit message:
Initial commit;

Changed in this revision

FT800_2.lib Show annotated file Show diff for this revision Revisions of this file
HYT.lib Show annotated file Show diff for this revision Revisions of this file
TFT/display.Calibration.cpp Show annotated file Show diff for this revision Revisions of this file
TFT/display.DisplayListFunctions.cpp Show annotated file Show diff for this revision Revisions of this file
TFT/display.Draw_24hrsStatistics.cpp Show annotated file Show diff for this revision Revisions of this file
TFT/display.Draw_30minStatistics.cpp Show annotated file Show diff for this revision Revisions of this file
TFT/display.Draw_3hrsStatistics.cpp Show annotated file Show diff for this revision Revisions of this file
TFT/display.Draw_AboutSensor.cpp Show annotated file Show diff for this revision Revisions of this file
TFT/display.Draw_CurrentValues.cpp Show annotated file Show diff for this revision Revisions of this file
TFT/display.Draw_Grids.cpp Show annotated file Show diff for this revision Revisions of this file
TFT/display.Draw_MainMenu.cpp Show annotated file Show diff for this revision Revisions of this file
TFT/display.Draw_MainMenuReference.cpp Show annotated file Show diff for this revision Revisions of this file
TFT/display.Draw_TimeSinceTurnOn.cpp Show annotated file Show diff for this revision Revisions of this file
TFT/display.GetTouch.cpp Show annotated file Show diff for this revision Revisions of this file
TFT/display.ImagesAndFonts.cpp Show annotated file Show diff for this revision Revisions of this file
TFT/display.StringsTransform.cpp Show annotated file Show diff for this revision Revisions of this file
display.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
pictures.h Show annotated file Show diff for this revision Revisions of this file
statistics.cpp Show annotated file Show diff for this revision Revisions of this file
statistics.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FT800_2.lib	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/dreschpe/code/FT800_2/#16e22c789f7d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HYT.lib	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/Ksenia/code/HYT/#cb02bfe8cf44
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TFT/display.Calibration.cpp	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,12 @@
+#include "display.h"
+
+/**************************************************************************************************************************
+************************** Put calibration data to FT800 ******************************************************************
+**************************************************************************************************************************/
+void Display::Calibration()
+{   
+    char calibration[25] = {98, 99, 0, 0, 182, 254, 255, 255, 245, 142, 248, 255, 117, 254, 255, 255, 34, 98, 0, 0, 123, 154, 248, 255};
+    for (int i = 0; i < 24; i++) {
+        (*_TFT).Wr8(REG_TOUCH_TRANSFORM_A + i, calibration[i]);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TFT/display.DisplayListFunctions.cpp	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,27 @@
+#include "display.h"
+
+/**************************************************************************************************************************
+************************** Start display list *****************************************************************************
+**************************************************************************************************************************/
+void Display::StartDL()
+{
+    (*_TFT).DLstart();
+    // set white color for background
+    (*_TFT).DL(CLEAR_COLOR_RGB(255, 255, 255));
+    // clear buffers for preset values
+    (*_TFT).DL(CLEAR(1, 1, 1));
+}
+
+/**************************************************************************************************************************
+************************** Finish display list ****************************************************************************
+**************************************************************************************************************************/
+void Display::FinishDL()
+{
+    (*_TFT).DL(DISPLAY());
+    // Swap the current display list
+    (*_TFT).Swap();
+    // Download the command list into fifo TFT
+    (*_TFT).Flush_Co_Buffer();
+    //  Wait for the complete consumption of FT800 Coprocessor commands
+    (*_TFT).WaitCmdfifo_empty();
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TFT/display.Draw_24hrsStatistics.cpp	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,144 @@
+#include "display.h"
+
+/**************************************************************************************************************************
+************************** Display data about humidity in the 24-hour interval ********************************************
+**************************************************************************************************************************/
+
+void Display::StatHumidity_24hrs(volatile uint64_t seconds, short int statistics24hrs[3][288], uint64_t gridSecondsOffset)
+{
+    // start FT800 display list
+    StartDL();
+ 
+    // mark 8 areas for touch input (for zoom in),
+    // make each every second zone gray, make the active zone green
+    char ZonesCnt = 0;
+    for (int i = 25; i < 433; i += 17 * 3) {
+        (*_TFT).DL(COLOR_RGB(255, 255, 255));
+        if (ZonesCnt % 2 == 0) {
+            (*_TFT).DL(COLOR_RGB(233, 233, 233));
+        }
+        if (pressedButton - ZONE_1_PRESS == ZonesCnt) {
+            (*_TFT).DL(COLOR_RGB(200, 255, 200));
+            timePoint3hrs = 36 * ZonesCnt;
+        }
+        (*_TFT).DL(TAG_MASK(1));
+        (*_TFT).DL(TAG(ZONE_1_PRESS + ZonesCnt));
+        (*_TFT).DL(BEGIN(RECTS));
+        (*_TFT).DL(VERTEX2II(i, 100, 0, 0));
+        (*_TFT).DL(VERTEX2II(i + 17 * 3, 200, 0, 0));
+        (*_TFT).DL(TAG_MASK(0));
+        ZonesCnt++;
+    }
+
+    // create time string, GridLines, link to main menu 
+    TimeSinceTurnOn(seconds);
+    VerticalGrid24hrs(gridSecondsOffset);
+    HorisontalGrid_Statistics_Humidity();
+    MainMenuReference();
+    
+    // draw graph line
+    (*_TFT).DL(COLOR_RGB(0, 0, 0));
+    for (int i = 1; i < 287; i++) {
+        short int currentValue = statistics24hrs[0][i];
+        if (currentValue != INIT_STATISTICS_NUMBER) {
+            char previousValue = statistics24hrs[0][i - 1];
+            char delta = statistics24hrs[2][i] - statistics24hrs[1][i];
+            if (delta >= DELTA_HUMIDITY) {
+                (*_TFT).DL(COLOR_RGB(255, 0, 0));
+                (*_TFT).DL(BEGIN(LINES));
+                (*_TFT).DL(LINE_WIDTH(8));
+                (*_TFT).DL(VERTEX2F(i * 23 + 25 * 16, (200 - currentValue) * 16));
+                (*_TFT).DL(VERTEX2F(i * 23 + 25 * 16, (180 - currentValue) * 16));
+                (*_TFT).DL(END());
+                (*_TFT).DL(BEGIN(POINTS));
+                (*_TFT).DL(POINT_SIZE(33));
+                (*_TFT).DL(VERTEX2F(i * 23 + 25 * 16, (180 - currentValue) * 16));
+                (*_TFT).DL(END());
+            }
+            (*_TFT).DL(COLOR_RGB(0, 0, 0));
+            (*_TFT).DL(BEGIN(LINES));
+            (*_TFT).DL(LINE_WIDTH(16));
+            (*_TFT).DL(VERTEX2F((i - 1) * 23 + 25 * 16, (200 - previousValue) * 16));
+            (*_TFT).DL(VERTEX2F(i * 23 + 25 * 16, (200 - currentValue) * 16));
+            (*_TFT).DL(END());
+        }
+    }
+
+    // write main title
+    (*_TFT).DL(COLOR_RGB(0, 0, 0));
+    (*_TFT).Text(11, 15, 30, 0, "Humidity statistics (24 hrs)");
+    
+    // finish FT800 display list
+    FinishDL();
+}
+
+/**************************************************************************************************************************
+************************** Display data about temperature in the 24-hour interval *****************************************
+**************************************************************************************************************************/
+
+void Display::StatTemperature_24hrs(volatile uint64_t seconds, short int statistics24hrs[3][288], uint64_t gridSecondsOffset)
+{
+    // start FT800 display list
+    StartDL();
+ 
+    // mark 8 areas for touch input (for zoom in),
+    // make each every second zone gray, make the active zone green
+    char ZonesCnt = 0;
+    for (int i = 25; i < 433; i += 17 * 3) {
+        (*_TFT).DL(COLOR_RGB(255, 255, 255));
+        if (ZonesCnt % 2 == 0) {
+            (*_TFT).DL(COLOR_RGB(233, 233, 233));
+        }
+        if (pressedButton - ZONE_1_PRESS == ZonesCnt) {
+            (*_TFT).DL(COLOR_RGB(200, 255, 200));
+            timePoint3hrs = 36 * ZonesCnt;
+        }
+        (*_TFT).DL(TAG_MASK(1));
+        (*_TFT).DL(TAG(ZONE_1_PRESS + ZonesCnt));
+        (*_TFT).DL(BEGIN(RECTS));
+        (*_TFT).DL(VERTEX2II(i, 100, 0, 0));
+        (*_TFT).DL(VERTEX2II(i + 17 * 3, 200, 0, 0));
+        (*_TFT).DL(TAG_MASK(0));
+        ZonesCnt++;
+    }
+
+    // create time string, GridLines, link to main menu 
+    TimeSinceTurnOn(seconds);
+    VerticalGrid24hrs(gridSecondsOffset);
+    HorisontalGrid_Statistics_Temperature();
+    MainMenuReference();
+    
+    // draw graph line
+    (*_TFT).DL(COLOR_RGB(0, 0, 0));
+    for (int i = 1; i < 287; i++) {
+        char previousValue = (statistics24hrs[0][i - 1] / TEMPERATURE_MULTIPLIER + 50) * 0.57;
+        char currentValue = (statistics24hrs[0][i] / TEMPERATURE_MULTIPLIER + 50) * 0.57;
+        char delta = statistics24hrs[2][i] - statistics24hrs[1][i];
+        if (statistics24hrs[0][i] != INIT_STATISTICS_NUMBER) {
+            if (delta >= DELTA_TEMPERATURE * TEMPERATURE_MULTIPLIER) {
+                (*_TFT).DL(COLOR_RGB(255, 0, 0));
+                (*_TFT).DL(BEGIN(LINES));
+                (*_TFT).DL(LINE_WIDTH(8));
+                (*_TFT).DL(VERTEX2F(i * 23 + 25 * 16, (200 - currentValue) * 16));
+                (*_TFT).DL(VERTEX2F(i * 23 + 25 * 16, (180 - currentValue) * 16));
+                (*_TFT).DL(END());
+                (*_TFT).DL(BEGIN(POINTS));
+                (*_TFT).DL(POINT_SIZE(33));
+                (*_TFT).DL(VERTEX2F(i * 23 + 25 * 16, (180 - currentValue) * 16));
+                (*_TFT).DL(END());
+            }
+            (*_TFT).DL(COLOR_RGB(0, 0, 0));
+            (*_TFT).DL(BEGIN(LINES));
+            (*_TFT).DL(LINE_WIDTH(16));
+            (*_TFT).DL(VERTEX2F((i - 1) * 23 + 25 * 16, (200 - previousValue) * 16));
+            (*_TFT).DL(VERTEX2F(i * 23 + 25 * 16, (200 - currentValue) * 16));
+        }
+    }
+
+    // write main title
+    (*_TFT).DL(COLOR_RGB(0, 0, 0));
+    (*_TFT).Text(11, 15, 30, 0, "Temperature statistics (24 hrs)");
+
+    // finish FT800 display list
+    FinishDL();
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TFT/display.Draw_30minStatistics.cpp	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,181 @@
+#include "display.h"
+
+/**************************************************************************************************************************
+************************** Display data about humidity in the 30-minutes interval *****************************************
+**************************************************************************************************************************/
+
+void Display::StatHumidity_30min(volatile uint64_t seconds, short int statistics24hrs[3][288], uint64_t gridSecondsOffset)
+{
+    // start FT800 display list
+    StartDL();
+ 
+    // mark the plot area as touch input (to return to 24-hrs statistics)
+    (*_TFT).DL(COLOR_RGB(213, 213, 213));
+    (*_TFT).DL(TAG_MASK(1));
+    (*_TFT).DL(TAG(STAT_HUM_PRESS));
+    (*_TFT).DL(BEGIN(RECTS));
+    (*_TFT).DL(VERTEX2II(25, 100, 0, 0));
+    (*_TFT).DL(VERTEX2II(433, 200, 0, 0));
+    (*_TFT).DL(TAG_MASK(0));
+    
+    // create time string, GridLines, link to main menu 
+    TimeSinceTurnOn(seconds);
+    VerticalGrid30min(gridSecondsOffset);
+    HorisontalGrid_Statistics_Humidity();
+    MainMenuReference();
+    
+    // draw graph line
+    for (int i = 0; i < 6; i++) {
+        char currentValue = statistics24hrs[0][i + timePoint3hrs + timePoint30min];
+        char currentMinValue = statistics24hrs[1][i + timePoint3hrs + timePoint30min];
+        char currentMaxValue = statistics24hrs[2][i + timePoint3hrs + timePoint30min];
+        if (currentValue != INIT_STATISTICS_NUMBER && (i + timePoint3hrs + timePoint30min) != 0) {
+            if (currentMaxValue - currentMinValue >= DELTA_HUMIDITY) {
+                (*_TFT).DL(COLOR_RGB(207, 45, 13));
+                (*_TFT).Number(i * 68, 200 - currentMaxValue - 15, 26, 0, currentMaxValue);
+                (*_TFT).Number(i * 68, 200 - currentMinValue + 1, 26, 0, currentMinValue);
+                (*_TFT).Number(i * 68 + 43, 200 - currentValue - 7, 26, 0, currentValue);
+            } else {
+                (*_TFT).DL(COLOR_RGB(9, 0, 63));
+                (*_TFT).Number(i * 68 + 43, 200 - currentValue - 7, 26, 0, currentValue);
+            }
+            (*_TFT).DL(BEGIN(LINES));
+            (*_TFT).DL(LINE_WIDTH(16));
+            (*_TFT).DL(VERTEX2F((i * 68 + 25) * 16, (200 - currentValue) * 16));
+            (*_TFT).DL(VERTEX2F((i * 68 + 25) * 16, (200 - currentMaxValue) * 16));
+            (*_TFT).DL(VERTEX2F((i * 68 + 10) * 16, (200 - currentMaxValue) * 16));
+            (*_TFT).DL(VERTEX2F((i * 68 + 40) * 16, (200 - currentMaxValue) * 16));
+            (*_TFT).DL(END());
+
+            (*_TFT).DL(BEGIN(LINES));
+            (*_TFT).DL(LINE_WIDTH(16));
+            (*_TFT).DL(VERTEX2F((i * 68 + 25) * 16, (200 - currentValue) * 16));
+            (*_TFT).DL(VERTEX2F((i * 68 + 25) * 16, (200 - currentMinValue) * 16));
+            (*_TFT).DL(VERTEX2F((i * 68 + 10) * 16, (200 - currentMinValue) * 16));
+            (*_TFT).DL(VERTEX2F((i * 68 + 40) * 16, (200 - currentMinValue) * 16));
+            (*_TFT).DL(END());
+
+            (*_TFT).DL(BEGIN(POINTS));
+            (*_TFT).DL(POINT_SIZE(70));
+            (*_TFT).DL(VERTEX2F((i * 68 + 25) * 16, (200 - currentValue) * 16));
+            (*_TFT).DL(END());
+
+            (*_TFT).DL(BEGIN(LINES));
+            (*_TFT).DL(LINE_WIDTH(24));
+            (*_TFT).DL(VERTEX2F((i * 68 + 15) * 16, (200 - currentValue) * 16));
+            (*_TFT).DL(VERTEX2F((i * 68 + 35) * 16, (200 - currentValue) * 16));
+            (*_TFT).DL(END());
+        }
+        if (timePoint3hrs + timePoint30min == 0) {
+            (*_TFT).DL(COLOR_RGB(9, 0, 63));
+            (*_TFT).DL(BEGIN(POINTS));
+            (*_TFT).DL(POINT_SIZE(70));
+            (*_TFT).DL(VERTEX2F(25 * 16, (200 - statistics24hrs[0][0]) * 16));
+            (*_TFT).DL(END());
+        }
+    }
+    
+    // write main title
+    (*_TFT).DL(COLOR_RGB(0, 0, 0));
+    (*_TFT).Text(11, 15, 30, 0, "Humidity statistics (30 min)");
+    
+    // finish FT800 display list
+    FinishDL();
+}
+
+/**************************************************************************************************************************
+************************** Display data about temperature in the 30-minutes interval **************************************
+**************************************************************************************************************************/
+
+void Display::StatTemperature_30min(volatile uint64_t seconds, short int statistics24hrs[3][288], uint64_t gridSecondsOffset)
+{
+    // strings needed to output temperature values with decimal mark
+    char currentValueStr[8], currentMinValueStr[8], currentMaxValueStr[8];
+
+    // start FT800 display list
+    StartDL();
+ 
+    // mark the plot area as touch input (to return to 24-hrs statistics)    
+    (*_TFT).DL(COLOR_RGB(213, 213, 213));
+    (*_TFT).DL(TAG_MASK(1));
+    (*_TFT).DL(TAG(STAT_TEMP_PRESS));
+    (*_TFT).DL(BEGIN(RECTS));
+    (*_TFT).DL(VERTEX2II(25, 100, 0, 0));
+    (*_TFT).DL(VERTEX2II(433, 200, 0, 0));
+    (*_TFT).DL(TAG_MASK(0));
+
+    // create time string, GridLines, link to main menu 
+    TimeSinceTurnOn(seconds);
+    VerticalGrid30min(gridSecondsOffset);
+    HorisontalGrid_Statistics_Temperature();
+    MainMenuReference();
+
+    // draw graph line
+    // Temperature values are multiplied by 10 in the statistics data array.
+    // To receive "normal" temperature with decimal mark we have to divide it
+    for (int i = 0; i < 6; i++) {
+        char currentValue_toDraw = (statistics24hrs[0][i + timePoint3hrs + timePoint30min] / TEMPERATURE_MULTIPLIER + 50) * 0.57;
+        char currentMinValue_toDraw = (statistics24hrs[1][i + timePoint3hrs + timePoint30min] / TEMPERATURE_MULTIPLIER + 50) * 0.57;
+        char currentMaxValue_toDraw = (statistics24hrs[2][i + timePoint3hrs + timePoint30min] / TEMPERATURE_MULTIPLIER + 50) * 0.57;
+
+        short int currentValue_multiplied = statistics24hrs[0][i + timePoint3hrs + timePoint30min];
+        CreateStringMultipliedTemp(currentValueStr, currentValue_multiplied);
+        short int currentMinValue_multiplied = statistics24hrs[1][i + timePoint3hrs + timePoint30min];
+        CreateStringMultipliedTemp(currentMinValueStr, currentMinValue_multiplied);
+        short int currentMaxValue_multiplied = statistics24hrs[2][i + timePoint3hrs + timePoint30min];
+        CreateStringMultipliedTemp(currentMaxValueStr, currentMaxValue_multiplied);
+
+        short int delta = currentMaxValue_multiplied - currentMinValue_multiplied;
+        if (currentValue_multiplied != INIT_STATISTICS_NUMBER && (i + timePoint3hrs + timePoint30min) != 0) {
+            if (delta >= DELTA_TEMPERATURE * TEMPERATURE_MULTIPLIER) {
+                (*_TFT).DL(COLOR_RGB(207, 45, 13));
+                (*_TFT).Text(i * 68 + 5, 200 - currentMaxValue_toDraw - 17, 20, 0, currentMaxValueStr);
+                (*_TFT).Text(i * 68 + 5, 200 - currentMinValue_toDraw + 3, 20, 0, currentMinValueStr);
+                (*_TFT).Text(i * 68 + 43, 200 - currentValue_toDraw - 7, 26, 0, currentValueStr);
+            } else {
+                (*_TFT).DL(COLOR_RGB(9, 0, 63));
+                (*_TFT).Text(i * 68 + 43, 200 - currentValue_toDraw - 7, 26, 0, currentValueStr);
+            }
+            (*_TFT).DL(BEGIN(LINES));
+            (*_TFT).DL(LINE_WIDTH(16));
+            (*_TFT).DL(VERTEX2F((i * 68 + 25) * 16, (200 - currentValue_toDraw) * 16));
+            (*_TFT).DL(VERTEX2F((i * 68 + 25) * 16, (200 - currentMaxValue_toDraw) * 16));
+            (*_TFT).DL(VERTEX2F((i * 68 + 10) * 16, (200 - currentMaxValue_toDraw) * 16));
+            (*_TFT).DL(VERTEX2F((i * 68 + 40) * 16, (200 - currentMaxValue_toDraw) * 16));
+            (*_TFT).DL(END());
+
+            (*_TFT).DL(BEGIN(LINES));
+            (*_TFT).DL(LINE_WIDTH(16));
+            (*_TFT).DL(VERTEX2F((i * 68 + 25) * 16, (200 - currentValue_toDraw) * 16));
+            (*_TFT).DL(VERTEX2F((i * 68 + 25) * 16, (200 - currentMinValue_toDraw) * 16));
+            (*_TFT).DL(VERTEX2F((i * 68 + 10) * 16, (200 - currentMinValue_toDraw) * 16));
+            (*_TFT).DL(VERTEX2F((i * 68 + 40) * 16, (200 - currentMinValue_toDraw) * 16));
+            (*_TFT).DL(END());
+
+            (*_TFT).DL(BEGIN(POINTS));
+            (*_TFT).DL(POINT_SIZE(70));
+            (*_TFT).DL(VERTEX2F((i * 68 + 25) * 16, (200 - currentValue_toDraw) * 16));
+            (*_TFT).DL(END());
+
+            (*_TFT).DL(BEGIN(LINES));
+            (*_TFT).DL(LINE_WIDTH(24));
+            (*_TFT).DL(VERTEX2F((i * 68 + 15) * 16, (200 - currentValue_toDraw) * 16));
+            (*_TFT).DL(VERTEX2F((i * 68 + 35) * 16, (200 - currentValue_toDraw) * 16));
+            (*_TFT).DL(END());
+        }
+        if (timePoint3hrs + timePoint30min == 0) {
+            (*_TFT).DL(COLOR_RGB(9, 0, 63));
+            (*_TFT).DL(BEGIN(POINTS));
+            (*_TFT).DL(POINT_SIZE(70));
+            (*_TFT).DL(VERTEX2F(25 * 16, (200 - statistics24hrs[0][0]) * 16));
+            (*_TFT).DL(END());
+        }
+    }
+
+    // write main title
+    (*_TFT).DL(COLOR_RGB(0, 0, 0));
+    (*_TFT).Text(11, 15, 30, 0, "Temperature statistics (30 min)");
+    
+    // finish FT800 display list
+    FinishDL();
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TFT/display.Draw_3hrsStatistics.cpp	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,150 @@
+#include "display.h"
+
+/**************************************************************************************************************************
+************************** Display data about humidity in the three-hour interval *****************************************
+**************************************************************************************************************************/
+
+void Display::StatHumidity_3hrs(volatile uint64_t seconds, short int statistics24hrs[3][288], uint64_t gridSecondsOffset)
+{
+    // start FT800 display list
+    StartDL();
+ 
+    // mark 6 areas for touch input (for zoom in),
+    // make each every second zone gray, make the active zone green
+    char ZonesCnt = 0;
+    for (int i = 25; i < 433; i += 68) {
+        (*_TFT).DL(COLOR_RGB(255, 255, 255));
+        if (ZonesCnt % 2 == 0) {
+            (*_TFT).DL(COLOR_RGB(233, 233, 233));
+        }
+        if (pressedButton - ZONE_1_PRESS == ZonesCnt) {
+            (*_TFT).DL(COLOR_RGB(200, 255, 200));
+            timePoint30min = 6 * ZonesCnt;
+        }
+        (*_TFT).DL(TAG_MASK(1));
+        (*_TFT).DL(TAG(ZONE_1_PRESS + ZonesCnt));
+        (*_TFT).DL(BEGIN(RECTS));
+        (*_TFT).DL(VERTEX2II(i, 100, 0, 0));
+        (*_TFT).DL(VERTEX2II(i + 68, 200, 0, 0));
+        (*_TFT).DL(TAG_MASK(0));
+        ZonesCnt++;
+    }
+    
+    // create time string, GridLines, link to main menu 
+    TimeSinceTurnOn(seconds);
+    VerticalGrid3hrs(gridSecondsOffset);
+    HorisontalGrid_Statistics_Humidity();
+    MainMenuReference();
+
+    // draw graph line
+    for (int i = 0; i < 36; i++) {
+        char currentValue = statistics24hrs[0][i + timePoint3hrs];
+        char currentMinValue = statistics24hrs[1][i + timePoint3hrs];
+        char currentMaxValue = statistics24hrs[2][i + timePoint3hrs];
+        if (currentValue != INIT_STATISTICS_NUMBER) {
+            (*_TFT).DL(COLOR_RGB(9, 0, 63));
+            if (currentMaxValue - currentMinValue >= DELTA_HUMIDITY) {
+                (*_TFT).DL(COLOR_RGB(207, 45, 13));
+                (*_TFT).DL(BEGIN(LINES));
+                (*_TFT).DL(LINE_WIDTH(16));
+                (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentValue) * 16));
+                (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentMaxValue) * 16));
+                (*_TFT).DL(VERTEX2F(i * 181 + 22 * 16, (200 - currentMaxValue) * 16));
+                (*_TFT).DL(VERTEX2F(i * 181 + 28 * 16, (200 - currentMaxValue) * 16));
+                (*_TFT).DL(END());
+                (*_TFT).DL(BEGIN(LINES));
+                (*_TFT).DL(LINE_WIDTH(16));
+                (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentValue) * 16));
+                (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentMinValue) * 16));
+                (*_TFT).DL(VERTEX2F(i * 181 + 22 * 16, (200 - currentMinValue) * 16));
+                (*_TFT).DL(VERTEX2F(i * 181 + 28 * 16, (200 - currentMinValue) * 16));
+                (*_TFT).DL(END());
+            } 
+            (*_TFT).DL(BEGIN(POINTS));
+            (*_TFT).DL(POINT_SIZE(45));
+            (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentValue) * 16));
+        }
+    }
+    
+    // write main title
+    (*_TFT).DL(COLOR_RGB(0, 0, 0));
+    (*_TFT).Text(11, 15, 30, 0, "Humidity statistics (3 hrs)");
+    
+    // finish FT800 display list
+    FinishDL();
+}
+
+/**************************************************************************************************************************
+************************** Display data about temeprature in the three-hour interval **************************************
+**************************************************************************************************************************/
+void Display::StatTemperature_3hrs(volatile uint64_t seconds, short int statistics24hrs[3][288], uint64_t gridSecondsOffset) 
+{
+    // start FT800 display list
+    StartDL();
+ 
+    // mark 6 areas for touch input (for zoom in),
+    // make each every second zone gray, make the active zone green
+    char ZonesCnt = 0;
+    for (int i = 25; i < 433; i += 68) {
+        (*_TFT).DL(COLOR_RGB(255, 255, 255));
+        if (ZonesCnt % 2 == 0) {
+            (*_TFT).DL(COLOR_RGB(233, 233, 233));
+        }
+        if (pressedButton - ZONE_1_PRESS == ZonesCnt) {
+            (*_TFT).DL(COLOR_RGB(200, 255, 200));
+            timePoint30min = 6 * ZonesCnt;
+        }
+        (*_TFT).DL(TAG_MASK(1));
+        (*_TFT).DL(TAG(ZONE_1_PRESS + ZonesCnt));
+        (*_TFT).DL(BEGIN(RECTS));
+        (*_TFT).DL(VERTEX2II(i, 100, 0, 0));
+        (*_TFT).DL(VERTEX2II(i + 68, 200, 0, 0));
+        (*_TFT).DL(TAG_MASK(0));
+        ZonesCnt++;
+    }
+
+    // create time string, GridLines, link to main menu 
+    TimeSinceTurnOn(seconds);
+    VerticalGrid3hrs(gridSecondsOffset);
+    HorisontalGrid_Statistics_Temperature();
+    MainMenuReference();
+    
+    // draw graph line
+    for (int i = 0; i < 36; i++) {
+        char currentValue = (statistics24hrs[0][i + timePoint3hrs] / TEMPERATURE_MULTIPLIER + 50) * 0.57;
+        char currentMinValue = (statistics24hrs[1][i + timePoint3hrs] / TEMPERATURE_MULTIPLIER + 50) * 0.57;
+        char currentMaxValue = (statistics24hrs[2][i + timePoint3hrs] / TEMPERATURE_MULTIPLIER + 50) * 0.57;
+        char delta = statistics24hrs[2][i + timePoint3hrs] - statistics24hrs[1][i + timePoint3hrs];
+        
+        if (statistics24hrs[0][i + timePoint3hrs] != INIT_STATISTICS_NUMBER) {
+            (*_TFT).DL(COLOR_RGB(9, 0, 63));
+            if (delta >= DELTA_TEMPERATURE + TEMPERATURE_MULTIPLIER) {
+                (*_TFT).DL(COLOR_RGB(207, 45, 13));
+                (*_TFT).DL(BEGIN(LINES));
+                (*_TFT).DL(LINE_WIDTH(16));
+                (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentValue) * 16));
+                (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentMaxValue) * 16));
+                (*_TFT).DL(VERTEX2F(i * 181 + 22 * 16, (200 - currentMaxValue) * 16));
+                (*_TFT).DL(VERTEX2F(i * 181 + 28 * 16, (200 - currentMaxValue) * 16));
+                (*_TFT).DL(END());
+                (*_TFT).DL(BEGIN(LINES));
+                (*_TFT).DL(LINE_WIDTH(16));
+                (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentValue) * 16));
+                (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentMinValue) * 16));
+                (*_TFT).DL(VERTEX2F(i * 181 + 22 * 16, (200 - currentMinValue) * 16));
+                (*_TFT).DL(VERTEX2F(i * 181 + 28 * 16, (200 - currentMinValue) * 16));
+                (*_TFT).DL(END());
+            } 
+            (*_TFT).DL(BEGIN(POINTS));
+            (*_TFT).DL(POINT_SIZE(45));
+            (*_TFT).DL(VERTEX2F(i * 181 + 25 * 16, (200 - currentValue) * 16));
+        }
+    }
+    
+    // write main title
+    (*_TFT).DL(COLOR_RGB(0, 0, 0));
+    (*_TFT).Text(11, 15, 30, 0, "Temperature statistics (3 hrs)");
+    
+    // finish FT800 display list
+    FinishDL();  
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TFT/display.Draw_AboutSensor.cpp	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,38 @@
+#include "display.h"
+
+/**************************************************************************************************************************
+************************** Display text & image about the HYT sensor ******************************************************
+**************************************************************************************************************************/
+void Display::AboutSensor()
+{
+    // start FT800 display list
+    StartDL();
+
+    // Write text
+    (*_TFT).DL(COLOR_RGB(0, 0, 0));
+    (*_TFT).DL(BEGIN(LINES));
+    (*_TFT).DL(LINE_WIDTH(8));
+    (*_TFT).DL(VERTEX2II(14, 79, 0, 0));
+    (*_TFT).DL(VERTEX2II(14, 220, 0, 0));
+    (*_TFT).Text(24, 78, 27, 0, "Capacitive polymer humidity sensor with I2C interface");
+    (*_TFT).DL(COLOR_RGB(9, 0, 63));
+    (*_TFT).Text(24, 115, 26, 0, "Measuring range: 0 .. 100% rH,  -40 .. 125 C");
+    (*_TFT).Text(24, 135, 26, 0, "Accuracy: +/-1.8% rH (0 .. 80% rH),");
+    (*_TFT).Text(88, 155, 26, 0, "+/-0.2 C (0 .. 60 C)");
+    (*_TFT).Text(24, 175, 26, 0, "Response time: < 4 sec");
+    (*_TFT).Text(24, 195, 26, 0, "Operating voltage: 2.7 to 5.5 V");
+    (*_TFT).DL(COLOR_RGB(0, 0, 0));
+    (*_TFT).Text(11, 15, 30, 0, "HYT-271 sensor from IST");
+
+    // Show photo
+    (*_TFT).DL(COLOR_RGB(255, 255, 255));
+    (*_TFT).DL(BEGIN(BITMAPS));
+    (*_TFT).DL(VERTEX2II(360, 140, 2, 0));
+    (*_TFT).DL(END());
+
+    // create link to main menu 
+    MainMenuReference();
+    
+    // finish FT800 display list
+    FinishDL();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TFT/display.Draw_CurrentValues.cpp	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,165 @@
+#include "display.h"
+
+/**************************************************************************************************************************
+************************** Display real-time humidity *********************************************************************
+**************************************************************************************************************************/
+
+void Display::CurrentHumidity(float humidity)
+{
+    // accelerator for x-axis data output
+    char accelerator = 6;
+    // create string including current humididty and " %"
+    CreateStringTempHum(humidityStr, humidity, 0);
+    // write the new scalable (* 1.5) data to the next available array position
+    currentHumidity_Y[currentHumidity_X] = (char)(humidity * 1.5);
+
+    // start FT800 display list
+    StartDL();
+
+    // draw bottom color for graph line
+    (*_TFT).DL(COLOR_RGB(200, 200, 200));
+    (*_TFT).DL(BEGIN(EDGE_STRIP_B));
+    for (int i = 0; i < 68; i++) {
+        if (currentHumidity_Y[i] != 0 && i <= currentHumidity_X) {
+            (*_TFT).DL(VERTEX2F((i * accelerator + 15) * 16, (220 - currentHumidity_Y[i]) * 16));
+        }
+    }
+
+    // draw horisontal grid for humidity (0 .. 100)
+    HorisontalGrid_Current_Humidity();
+
+    // draw main graph line
+    (*_TFT).DL(COLOR_RGB(9, 0, 63));
+    (*_TFT).DL(BEGIN(POINTS));
+    (*_TFT).DL(POINT_SIZE(25));
+    for (int i = 0; i < 68; i++) {
+        if (currentHumidity_Y[i] != 0 && (i < currentHumidity_X || i >= currentHumidity_X + 13)) {
+            (*_TFT).DL(VERTEX2F((i * accelerator + 15) * 16, (222 - currentHumidity_Y[i]) * 16));
+        }
+    }
+
+    // draw subtitle for main graph line
+    (*_TFT).DL(COLOR_RGB(255, 255, 255));
+    (*_TFT).DL(BEGIN(RECTS));
+    (*_TFT).DL(VERTEX2II((currentHumidity_X * accelerator + 40) + 25, (200 - currentHumidity_Y[currentHumidity_X]), 0, 0));
+    (*_TFT).DL(VERTEX2II((currentHumidity_X * accelerator + 40), (177 - currentHumidity_Y[currentHumidity_X]), 0, 0));
+    (*_TFT).DL(COLOR_RGB(255, 0, 0));
+    (*_TFT).Text((currentHumidity_X * accelerator + 30), (180 - currentHumidity_Y[currentHumidity_X] - 7), 28, 0, humidityStr);
+    (*_TFT).DL(BEGIN(LINES));
+    (*_TFT).DL(LINE_WIDTH(8));
+    (*_TFT).DL(VERTEX2F((currentHumidity_X * accelerator + 15) * 16, (220 - currentHumidity_Y[currentHumidity_X]) * 16));
+    (*_TFT).DL(VERTEX2F((currentHumidity_X * accelerator + 35) * 16, (200 - currentHumidity_Y[currentHumidity_X]) * 16));
+    (*_TFT).DL(COLOR_RGB(255, 30, 33));
+    (*_TFT).DL(BEGIN(POINTS));
+    (*_TFT).DL(POINT_SIZE(33));
+    (*_TFT).DL(VERTEX2F((currentHumidity_X * accelerator + 15) * 16, (220 - currentHumidity_Y[currentHumidity_X]) * 16));
+    (*_TFT).DL(END());
+
+    // write main title
+    (*_TFT).DL(COLOR_RGB(0, 0, 0));
+    (*_TFT).Text(11, 15, 30, 0, "Current humidity, rH");
+
+    // clean the space under the plot, create link to the main menu
+    (*_TFT).DL(SCISSOR_XY(15, 222));
+    (*_TFT).DL(SCISSOR_SIZE(420, 53));
+    (*_TFT).Gradient(0, 256, 0xFFFFFF, 450, 16, 0xFFFFFF);
+    MainMenuReference();
+
+    // finish FT800 display list
+    FinishDL();
+
+    // manage the index for array with real-time humidity
+    if (currentHumidity_X >= 68) {
+        currentHumidity_X = 0;
+    } else {
+        currentHumidity_X ++;
+    }
+    if (pressedButton == MENU_PRESS) {
+        for (int i = 0; i < 68; i++) {
+            currentHumidity_Y[i] = 0;
+            currentHumidity_X = 0;
+        }
+    }
+}
+
+/**************************************************************************************************************************
+************************** Display real-time temperature ******************************************************************
+**************************************************************************************************************************/
+
+void Display::CurrentTemperature(float temperature)
+{
+    // accelerator for x-axis data output
+    char accelerator = 6;
+    // create string including current temperature with decimal mark and " С"
+    char degreeOffset = CreateStringTempHum(temperatureStr, temperature, 1);
+    // write the new scalable (* 0.88 + 45) data to the next available array position
+    currentTemperature_Y[currentTemperature_X] = (char)(temperature * 0.88 + 45);
+
+    // start FT800 display list
+    StartDL();
+
+    // draw bottom color for graph line
+    (*_TFT).DL(COLOR_RGB(200, 177, 199));
+    (*_TFT).DL(BEGIN(EDGE_STRIP_B));
+    for (int i = 0; i < 68; i++) {
+        if (currentTemperature_Y[i] != 0 && i <= currentTemperature_X) {
+            (*_TFT).DL(VERTEX2F((i * accelerator + 15) * 16, (220 - currentTemperature_Y[i]) * 16));
+        }
+    }
+
+    // draw horisontal grid for temperature (-50 .. +125)
+    HorisontalGrid_Current_Temperature();
+
+    // draw main graph line
+    (*_TFT).DL(COLOR_RGB(9, 0, 63));
+    (*_TFT).DL(BEGIN(POINTS));
+    (*_TFT).DL(POINT_SIZE(25));
+    for (int i = 0; i < 68; i++) {
+        if (currentTemperature_Y[i] != 0 && (i < currentTemperature_X || i >= currentTemperature_X + 13)) {
+            (*_TFT).DL(VERTEX2F((i * accelerator + 15) * 16, (222 - currentTemperature_Y[i]) * 16));
+        }
+    }
+
+    // draw subtitle for main graph line
+    (*_TFT).DL(COLOR_RGB(255, 255, 255));
+    (*_TFT).DL(BEGIN(RECTS));
+    (*_TFT).DL(VERTEX2II((currentTemperature_X * accelerator + 40) + 25, (200 - currentTemperature_Y[currentTemperature_X]), 0, 0));
+    (*_TFT).DL(VERTEX2II((currentTemperature_X * accelerator + 40), (177 - currentTemperature_Y[currentTemperature_X]), 0, 0));
+    (*_TFT).DL(COLOR_RGB(255, 0, 0));
+    (*_TFT).Text((currentTemperature_X * accelerator + 25), (173 - currentTemperature_Y[currentTemperature_X]), 28, 0, temperatureStr);
+    (*_TFT).Text((currentTemperature_X * accelerator + 25) + (degreeOffset * 8 + 3), (173 - currentTemperature_Y[currentTemperature_X]) - 4, 20, 0, "o");
+    (*_TFT).DL(BEGIN(LINES));
+    (*_TFT).DL(LINE_WIDTH(8));
+    (*_TFT).DL(VERTEX2F((currentTemperature_X * accelerator + 15) * 16, (220 - currentTemperature_Y[currentTemperature_X]) * 16));
+    (*_TFT).DL(VERTEX2F((currentTemperature_X * accelerator + 35) * 16, (200 - currentTemperature_Y[currentTemperature_X]) * 16));
+    (*_TFT).DL(COLOR_RGB(255, 30, 33));
+    (*_TFT).DL(BEGIN(POINTS));
+    (*_TFT).DL(POINT_SIZE(33));
+    (*_TFT).DL(VERTEX2F((currentTemperature_X * accelerator + 15) * 16, (220 - currentTemperature_Y[currentTemperature_X]) * 16));
+    (*_TFT).DL(END());
+
+    // write main title
+    (*_TFT).DL(COLOR_RGB(0, 0, 0));
+    (*_TFT).Text(11, 15, 30, 0, "Current temperature");
+    
+    // clean the space under the plot, create link to the main menu
+    (*_TFT).DL(SCISSOR_XY(15, 225));
+    (*_TFT).DL(SCISSOR_SIZE(420, 53));
+    (*_TFT).Gradient(0, 256, 0xFFFFFF, 450, 16, 0xFFFFFF);
+    MainMenuReference();
+
+    // finish FT800 display list
+    FinishDL();
+
+    if (currentTemperature_X >= 68) {
+        currentTemperature_X = 0;
+    } else {
+        currentTemperature_X ++;
+    }
+    if (pressedButton == MENU_PRESS) {
+        for (int i = 0; i < 68; i++) {
+            currentTemperature_Y[i] = 0;
+            currentTemperature_X = 0;
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TFT/display.Draw_Grids.cpp	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,159 @@
+#include "display.h"
+
+/* For drawing current values */
+
+/**************************************************************************************************************************
+************************** Draw horisontal grid for current temperature (-50 .. +125) *************************************
+**************************************************************************************************************************/
+void Display::HorisontalGrid_Current_Temperature()
+{
+    (*_TFT).DL(COLOR_RGB(20, 20, 20));
+    char gridNumb = 125 + 50;
+    for (int i = 70 * 16; i <= 225 * 16; i += 352) {
+        (*_TFT).DL(BEGIN(LINES));
+        (*_TFT).DL(LINE_WIDTH(8));
+        (*_TFT).DL(VERTEX2F(15 * 16, i));
+        (*_TFT).DL(VERTEX2F(423 * 16, i));
+        if (gridNumb  >= 50) {
+            (*_TFT).Number(435, i/16 - 9, 26, 0, gridNumb - 50);
+        } else if (gridNumb == 25) {
+            (*_TFT).Text(435, i/16 - 9, 26, 0, "-25");
+        } else if (gridNumb == 0) {
+            (*_TFT).Text(435, i/16 - 9, 26, 0, "-50");
+        }
+        gridNumb = gridNumb - 25;
+    }
+}
+
+/**************************************************************************************************************************
+************************** Draw horisontal grid for current humidity (0 .. 100) *******************************************
+**************************************************************************************************************************/
+void Display::HorisontalGrid_Current_Humidity()
+{
+    (*_TFT).DL(COLOR_RGB(20, 20, 20));
+    char gridNumb = 100;
+    for (int i = 70 * 16; i <= 220 * 16; i += 600) {
+        (*_TFT).DL(BEGIN(LINES));
+        (*_TFT).DL(LINE_WIDTH(8));
+        (*_TFT).DL(VERTEX2F(15 * 16, i));
+        (*_TFT).DL(VERTEX2F(423 * 16, i));
+        (*_TFT).Number(435, i/16 - 9, 26, 0, gridNumb);
+        gridNumb = gridNumb - 25;
+    }
+}
+
+
+
+/* For drawing statistics values */
+
+/**************************************************************************************************************************
+************************** Draw horisontal grid for temperature (-50 .. +125) *********************************************
+**************************************************************************************************************************/
+void Display::HorisontalGrid_Statistics_Temperature()
+{
+    (*_TFT).DL(COLOR_RGB(80, 80, 80));
+    char gridNumb = 125 + 50;
+    for (int i = 100 * 16; i <= 200 * 16; i += 228) {
+        (*_TFT).DL(BEGIN(LINES));
+        (*_TFT).DL(LINE_WIDTH(8));
+        if (gridNumb == 0 + 50) {
+            (*_TFT).DL(LINE_WIDTH(12));
+        }
+        (*_TFT).DL(VERTEX2F(25 * 16, i));
+        (*_TFT).DL(VERTEX2F(438 * 16, i));
+        if (gridNumb  >= 50) {
+            (*_TFT).Number(445, i/16 - 9, 26, 0, gridNumb - 50);
+        } else if (gridNumb == 25) {
+            (*_TFT).Text(445, i/16 - 9, 26, 0, "-25");
+        } else if (gridNumb == 0) {
+            (*_TFT).Text(445, i/16 - 9, 26, 0, "-50");
+        }
+        gridNumb = gridNumb - 25;
+    }
+}
+
+/**************************************************************************************************************************
+************************** Draw horisontal grid for humidity (0 .. 100) ***************************************************
+**************************************************************************************************************************/
+void Display::HorisontalGrid_Statistics_Humidity()
+{
+    (*_TFT).DL(COLOR_RGB(80, 80, 80));
+    char gridNumb = 100;
+    for (int i = 100 * 16; i <= 200 * 16; i += (25*16)) {
+        (*_TFT).DL(BEGIN(LINES));
+        (*_TFT).DL(LINE_WIDTH(8));
+        (*_TFT).DL(VERTEX2F(25 * 16, i));
+        (*_TFT).DL(VERTEX2F(438 * 16, i));
+        (*_TFT).Number(445, i/16 - 9, 26, 0, gridNumb);
+        gridNumb = gridNumb - 25;
+    }
+}
+
+/**************************************************************************************************************************
+************************** Draw vertical grid for 24-hour interval ******************************************&*************
+**************************************************************************************************************************/
+void Display::VerticalGrid24hrs(uint64_t gridSecondsOffset)
+{
+    uint64_t gridSeconds = gridSecondsOffset;
+    for (int i = 25 * 16; i <= 433 * 16; i += 17 * 16) {
+        (*_TFT).DL(COLOR_RGB(80, 80, 80));
+        (*_TFT).DL(BEGIN(LINES));
+        (*_TFT).DL(LINE_WIDTH(8));
+        (*_TFT).DL(VERTEX2F(i, 100 * 16));
+        (*_TFT).DL(VERTEX2F(i, 200 * 16));
+        CreateStringTime(gridTimeStr, gridSeconds);
+        if ((i - 25 * 16) % (3 * 17 * 16) == 0) {
+            (*_TFT).Text(i/16 - 20, 210, 20, 0, gridTimeStr);
+            (*_TFT).DL(COLOR_RGB(20, 20, 20));
+            (*_TFT).DL(BEGIN(LINES));
+            (*_TFT).DL(VERTEX2F(i, 100 * 16));
+            (*_TFT).DL(VERTEX2F(i, 205 * 16));
+        }
+        gridSeconds = gridSeconds + 3600;
+    }
+}
+
+/**************************************************************************************************************************
+************************** Draw vertical grid for three-hour interval *****************************************************
+**************************************************************************************************************************/
+void Display::VerticalGrid3hrs(uint64_t gridSecondsOffset)
+{
+    (*_TFT).DL(COLOR_RGB(0, 0, 0));
+    uint64_t gridSeconds = 300 * timePoint3hrs + gridSecondsOffset;
+    for (int i = 25 * 16; i <= 433 * 16; i += 34 * 16) {
+        (*_TFT).DL(BEGIN(LINES));
+        (*_TFT).DL(LINE_WIDTH(8));
+        (*_TFT).DL(VERTEX2F(i, 100 * 16));
+        (*_TFT).DL(VERTEX2F(i, 200 * 16));
+        CreateStringTime(gridTimeStr, gridSeconds);
+        if ((i - 25*16) % (2 * 34 * 16) == 0) {
+            (*_TFT).DL(COLOR_RGB(80, 80, 80));
+            (*_TFT).Text(i/16 - 20, 210, 20, 0, gridTimeStr);
+            (*_TFT).DL(COLOR_RGB(0, 0, 0));
+            (*_TFT).DL(BEGIN(LINES));
+            (*_TFT).DL(VERTEX2F(i, 100 * 16));
+            (*_TFT).DL(VERTEX2F(i, 205 * 16));
+        }
+        gridSeconds = gridSeconds + 900;
+    }
+}
+
+/**************************************************************************************************************************
+************************** Draw vertical grid for 30-minutes interval *****************************************************
+**************************************************************************************************************************/
+void Display::VerticalGrid30min(uint64_t gridSecondsOffset)
+{
+    (*_TFT).DL(COLOR_RGB(0, 0, 0));
+    uint64_t gridSeconds = 300 * (timePoint3hrs + timePoint30min) + gridSecondsOffset;
+    for (int i = 25 * 16; i <= 433 * 16; i += 68 * 16) {
+        (*_TFT).DL(BEGIN(LINES));
+        (*_TFT).DL(LINE_WIDTH(8));
+        (*_TFT).DL(VERTEX2F(i, 100 * 16));
+        (*_TFT).DL(VERTEX2F(i, 205 * 16));
+        CreateStringTime(gridTimeStr, gridSeconds);
+        (*_TFT).DL(COLOR_RGB(80, 80, 80));
+        (*_TFT).Text(i/16 - 20, 210, 20, 0, gridTimeStr);
+        (*_TFT).DL(COLOR_RGB(0, 0, 0));
+        gridSeconds = gridSeconds + 300;
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TFT/display.Draw_MainMenu.cpp	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,112 @@
+#include "display.h"
+
+/**************************************************************************************************************************
+************************** Display Main Menu ******************************************************************************
+**************************************************************************************************************************/
+
+void Display::MainMenu(float humidity, float temperature)
+{
+     // start FT800 display list
+    StartDL();
+    
+    // write main title
+    (*_TFT).DL(COLOR_RGB(0, 0, 0));
+
+    (*_TFT).Text(11, 15, 30, 0, "HYT-271 sensor from IST");
+   
+    // create blue rectangle with current humididty including 
+    // rectangle is tagged as CURR_HUM_PRESS
+    (*_TFT).DL(TAG_MASK(1));
+    (*_TFT).DL(TAG(CURR_HUM_PRESS));
+    (*_TFT).DL(COLOR_RGB(9, 0, 63));
+    // if rectangle is already pressed, draw it with lighter color
+    if (pressedButton == CURR_HUM_PRESS) {
+        (*_TFT).DL(COLOR_RGB(75, 70, 108));
+    }
+    (*_TFT).DL(BEGIN(RECTS));
+    (*_TFT).DL(VERTEX2II(12 + 222 + 12, 62, 0, 0));
+    (*_TFT).DL(VERTEX2II(12 + 222 + 12 + 222, 62 + 124, 0, 0));
+    (*_TFT).DL(COLOR_RGB(255, 255, 255));
+    (*_TFT).Text(12 + 222 + 12 + 10, 62 + 5, 29, 0, "Current");
+    (*_TFT).Text(12 + 222 + 12 + 10, 62 + 35, 29, 0, "humidity (rH)");
+    CreateStringTempHum(humidityStr, humidity, 0);
+    (*_TFT).Text(12 + 222 + 12 + 10, 62 + 75, 31, 0, humidityStr);
+    (*_TFT).DL(BEGIN(BITMAPS));
+    (*_TFT).DL(VERTEX2II(12 + 222 + 10 + 180, 62 + 10, 0, 0));
+    (*_TFT).DL(END());
+    (*_TFT).DL(TAG_MASK(0));
+
+    // create blue rectangle with current temperature including 
+    // rectangle is tagged as CURR_TEMP_PRESS
+    (*_TFT).DL(TAG_MASK(1));
+    (*_TFT).DL(TAG(CURR_TEMP_PRESS));
+    (*_TFT).DL(COLOR_RGB(9, 0, 63));
+    // if rectangle is already pressed, draw it with lighter color
+    if (pressedButton == CURR_TEMP_PRESS) {
+        (*_TFT).DL(COLOR_RGB(75, 70, 108));
+    }
+    (*_TFT).DL(BEGIN(RECTS));
+    (*_TFT).DL(VERTEX2II(12, 62, 0, 0));
+    (*_TFT).DL(VERTEX2II(12 + 222, 62 + 124, 0, 0));
+    (*_TFT).DL(COLOR_RGB(255, 255, 255));
+    (*_TFT).Text(12 + 10, 62 + 5, 29, 0, "Current");
+    (*_TFT).Text(12 + 10, 62 + 35, 29, 0, "temperature");
+    char degreeOffset = CreateStringTempHum(temperatureStr, temperature, 1);
+    (*_TFT).Text(12 + 10, 62 + 75, 31, 0, temperatureStr);
+    (*_TFT).Text(12 + 10 + (degreeOffset * 16 + 3), 62 + 75 - 2, 28, 0, "o");
+    (*_TFT).DL(BEGIN(BITMAPS));
+    (*_TFT).DL(VERTEX2II(12 + 10 + 180, 62 + 7, 1, 0));
+    (*_TFT).DL(END());
+    (*_TFT).DL(TAG_MASK(0));
+
+    // create black rectangle tagged as STAT_HUM_PRESS    
+    (*_TFT).DL(TAG_MASK(1));
+    (*_TFT).DL(TAG(STAT_HUM_PRESS));
+    (*_TFT).DL(COLOR_RGB(36, 36, 36));
+    // if rectangle is already pressed, draw it with lighter color
+    if (pressedButton == STAT_HUM_PRESS) {
+        (*_TFT).DL(COLOR_RGB(56, 56, 56));
+    }
+    (*_TFT).DL(BEGIN(RECTS));
+    (*_TFT).DL(VERTEX2II(12, 62 + 124 + 12, 0, 0));
+    (*_TFT).DL(VERTEX2II(12 + 144, 62 + 124 + 12 + 62, 0, 0));
+    (*_TFT).DL(COLOR_RGB(255, 255, 255));
+    (*_TFT).Text(12 + 10, 62 + 124 + 12 + 5, 27, 0, "Humidity");
+    (*_TFT).Text(12 + 10, 62 + 124 + 12 + 30, 27, 0, "statisticss");
+    (*_TFT).DL(TAG_MASK(0));
+
+    // create black rectangle tagged as STAT_TEMP_PRESS    
+    (*_TFT).DL(TAG_MASK(1));
+    (*_TFT).DL(TAG(STAT_TEMP_PRESS));
+    (*_TFT).DL(COLOR_RGB(36, 36, 36));
+    // if rectangle is already pressed, draw it lighter
+    if (pressedButton == STAT_TEMP_PRESS) {
+        (*_TFT).DL(COLOR_RGB(56, 56, 56));
+    }
+    (*_TFT).DL(BEGIN(RECTS));
+    (*_TFT).DL(VERTEX2II(12 + 144 + 12, 62 + 124 + 12, 0, 0));
+    (*_TFT).DL(VERTEX2II(12 + 144 + 12 + 144, 62 + 124 + 12 + 62, 0, 0));
+    (*_TFT).DL(COLOR_RGB(255, 255, 255));
+    (*_TFT).Text(12 +144 + 12 + 10, 62 + 124 + 12 + 5, 27, 0, "Temperature");
+    (*_TFT).Text(12 + 144 + 12 + 10, 62 + 124 + 12 + 30, 27, 0, "statistics");
+    (*_TFT).DL(TAG_MASK(0));
+    
+    // create black rectangle tagged as ABOUT_PRESS  
+    (*_TFT).DL(TAG_MASK(1));
+    (*_TFT).DL(TAG(ABOUT_PRESS));
+    (*_TFT).DL(COLOR_RGB(36, 36, 36));
+    // if rectangle is already pressed, draw it lighter
+    if (pressedButton == ABOUT_PRESS) {
+        (*_TFT).DL(COLOR_RGB(56, 56, 56));
+    }
+    (*_TFT).DL(BEGIN(RECTS));
+    (*_TFT).DL(VERTEX2II(12 + 144 + 12 + 144 + 12, 62 + 124 + 12, 0, 0));
+    (*_TFT).DL(VERTEX2II(12 + 144 + 12 + 144 + 12 + 144, 62 + 124 + 12 + 62, 0, 0));
+    (*_TFT).DL(COLOR_RGB(255, 255, 255));
+    (*_TFT).Text(12 + 144 + 12 + 144 + 12 + 10, 62 + 124 + 12 + 5, 27, 0, "About");
+    (*_TFT).Text(12 + 144 + 12 + 144 + 12 + 10, 62 + 124 + 12 + 30, 27, 0, "the sensor");
+    (*_TFT).DL(TAG_MASK(0));
+    
+    // finish FT800 display list
+    FinishDL();
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TFT/display.Draw_MainMenuReference.cpp	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,18 @@
+#include "display.h"
+
+/**************************************************************************************************************************
+************************** Draw link to the main menu screen **************************************************************
+**************************************************************************************************************************/
+void Display::MainMenuReference()
+{
+    (*_TFT).DL(COLOR_RGB(0, 0, 0));
+    (*_TFT).DL(TAG_MASK(1));
+    (*_TFT).DL(TAG(MENU_PRESS));
+    (*_TFT).Text(14, 240, 22, 0, "Main menu");
+    (*_TFT).DL(BEGIN(LINES));
+    (*_TFT).DL(LINE_WIDTH(8));
+    (*_TFT).DL(VERTEX2F(14 * 16, 260 * 16));
+    (*_TFT).DL(VERTEX2F(95 * 16, 260 * 16));
+    (*_TFT).Track(0, 230, 100, 30, MENU_PRESS);
+    (*_TFT).DL(TAG_MASK(0));
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TFT/display.Draw_TimeSinceTurnOn.cpp	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,16 @@
+#include "display.h"
+
+/**************************************************************************************************************************
+************************** Write the string with gray field with current time HH:MM:SS ************************************
+**************************************************************************************************************************/
+void Display::TimeSinceTurnOn(uint64_t seconds)
+{
+    (*_TFT).DL(COLOR_RGB(213, 213, 213));
+    (*_TFT).DL(BEGIN(RECTS));
+    (*_TFT).DL(VERTEX2II(300, 54, 0, 0));
+    (*_TFT).DL(VERTEX2II(228, 81, 0, 0));
+    (*_TFT).DL(COLOR_RGB(9, 0, 63));
+    (*_TFT).Text(15, 60, 26, 0, "Time since device was turned on: ");
+    CreateStringTime(timeStr, seconds);
+    (*_TFT).Text(232, 60, 26, 0, timeStr);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TFT/display.GetTouch.cpp	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,9 @@
+#include "display.h"
+
+/**************************************************************************************************************************
+************************** Get number (tag) of touched object *************************************************************
+**************************************************************************************************************************/
+char Display::GetTouch()
+{   
+    return (*_TFT).Rd8(REG_TOUCH_TAG);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TFT/display.ImagesAndFonts.cpp	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,45 @@
+#include "display.h"
+
+/**************************************************************************************************************************
+************************** Decompress images anf fonts from pictures.h and put them to the RAM memeory of FT800 ***********
+**************************************************************************************************************************/
+void Display::LoadImagesAndFonts()
+{
+    (*_TFT).WrCmd32(CMD_INFLATE);
+    (*_TFT).WrCmd32(IMAGE_ADDR_HUMIDITY);
+    (*_TFT).WrCmdBufFromFlash(hum_icon, sizeof(hum_icon));
+
+    (*_TFT).WrCmd32(CMD_INFLATE);
+    (*_TFT).WrCmd32(IMAGE_ADDR_TEMPERATURE);
+    (*_TFT).WrCmdBufFromFlash(temp_icon, sizeof(temp_icon));   
+       
+    (*_TFT).WrCmd32(CMD_INFLATE);
+    (*_TFT).WrCmd32(IMAGE_ADDR_SENSOR);
+    (*_TFT).WrCmdBufFromFlash(HYT_photo, sizeof(HYT_photo));
+}
+
+/**************************************************************************************************************************
+************************** Prepare images and fronts **********************************************************************
+**************************************************************************************************************************/
+void Display::HandleAllBitmaps()
+{
+     // start FT800 display list
+    StartDL();
+    
+    (*_TFT).DL(BITMAP_HANDLE(0));
+    (*_TFT).DL(BITMAP_SOURCE(IMAGE_ADDR_HUMIDITY));
+    (*_TFT).DL(BITMAP_LAYOUT(ARGB4, 60, 38));
+    (*_TFT).DL(BITMAP_SIZE(NEAREST, BORDER, BORDER, 30, 38));
+    
+    (*_TFT).DL(BITMAP_HANDLE(1));
+    (*_TFT).DL(BITMAP_SOURCE(IMAGE_ADDR_TEMPERATURE));
+    (*_TFT).DL(BITMAP_LAYOUT(ARGB4, 42, 42));
+    (*_TFT).DL(BITMAP_SIZE(NEAREST, BORDER, BORDER, 21, 42));
+        
+    (*_TFT).DL(BITMAP_HANDLE(2));
+    (*_TFT).DL(BITMAP_SOURCE(IMAGE_ADDR_SENSOR));
+    (*_TFT).DL(BITMAP_LAYOUT(ARGB1555, 208, 176));
+    (*_TFT).DL(BITMAP_SIZE(NEAREST, BORDER, BORDER, 104, 176));
+    // finish FT800 display list
+    FinishDL();
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TFT/display.StringsTransform.cpp	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,123 @@
+#include "display.h"
+
+/**************************************************************************************************************************
+************************** Transform humiditity / temperature float value to string ***************************************
+**************************************************************************************************************************/
+// If isTemp = 0, resulting string includes
+// 1. current humididty
+// 3. " %"
+
+// If isTemp = 1, resulting string includes
+// 1. "-" (optional),
+// 2. current temperature with decimal mark
+// 3. " С"
+
+// Returns offset using for placing degree sign
+char Display::CreateStringTempHum(char *str, float number, bool isTemp)
+{
+    char offsetForDegreeSign;
+    short int multipedNumber = (short int)(number * 100);
+    char strCnt = 0;
+    if (isTemp) {
+        if (multipedNumber < 0) {
+            multipedNumber = -multipedNumber;
+            str[strCnt] = '-';
+            strCnt++;
+        }
+    }
+    if (multipedNumber >= 10000) {
+        str[strCnt] = '0' + (multipedNumber % 100000) / 10000;
+        strCnt++;
+    }
+    if (multipedNumber >= 1000) {
+        str[strCnt] = '0' + (multipedNumber % 10000) / 1000;
+        strCnt++;
+    }
+    if (multipedNumber >= 100) {
+        str[strCnt] = '0' + (multipedNumber % 1000) / 100;
+        strCnt++;
+    }
+    if (isTemp) {
+        str[strCnt] = '.';
+        strCnt++;
+        str[strCnt] = '0' + (multipedNumber % 100) / 10;
+        strCnt++;
+        str[strCnt] = ' ';
+        strCnt++;
+        offsetForDegreeSign = strCnt;
+        str[strCnt] = 'C';
+        strCnt++;
+    } else {
+        str[strCnt] = '%';
+        strCnt++;
+    }
+    str[strCnt] = 0;
+    
+    return offsetForDegreeSign;
+}
+
+
+/**************************************************************************************************************************
+************************** Transform multiplied temperature value to string ***********************************************
+**************************************************************************************************************************/
+// Resulting string includes
+// 1. "-" (optional),
+// 2. current temperature with decimal mark
+void Display::CreateStringMultipliedTemp(char *str, short int number)
+{
+    char strCnt = 0;
+    if (number < 0) {
+        number = -number;
+        str[strCnt] = '-';
+        strCnt++;
+    }
+    if (number >= 1000) {
+        str[strCnt] = '0' + (number % 10000) / 1000;
+        strCnt++;
+    }
+    if (number >= 100) {
+        str[strCnt] = '0' + (number % 1000) / 100;
+        strCnt++;
+    }
+    if (number >= 10) {
+        str[strCnt] = '0' + (number % 100) / 10;
+        strCnt++;
+    }
+    str[strCnt] = '.';
+    strCnt++;
+    str[strCnt] = '0' + (number % 100) / 10;
+    strCnt++;
+    str[strCnt] = 0;
+}
+
+
+/**************************************************************************************************************************
+************************** Transform number of seconds to HH:MM:SS string *************************************************
+**************************************************************************************************************************/
+void Display::CreateStringTime(char *str, uint32_t numberOfSeconds)
+{
+    char hrs = (numberOfSeconds / 3600);
+    if (hrs < 10) {
+        str[0] = '0';
+    } else {
+        str[0] = '0' + hrs / 10;
+    }
+    str[1] = '0' + hrs % 10;
+    str[2] = ':';
+    char minutes = (numberOfSeconds / 60) % 60;
+    if (minutes < 10) {
+        str[3] = '0';
+    } else {
+        str[3] = '0' + minutes / 10;
+    }
+    str[4] = '0' + minutes % 10;
+    str[5] = ':';
+    char sec = numberOfSeconds % 60;
+    if (sec < 10) {
+        str[6] = '0';
+    } else {
+        str[6] = '0' + sec / 10;
+    }
+    str[7] = '0' + sec % 10;
+    str[8] = 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/display.h	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,123 @@
+#include "mbed.h"
+#include "FT_Platform.h"
+#include "pictures.h"
+#include "statistics.h"
+#include <string>
+
+#ifndef DISPLAY_H_
+#define DISPLAY_H_
+
+/**************************************************************************************************************************
+************************** Defines using for drawing **********************************************************************
+**************************************************************************************************************************/
+
+// all tracking touch screen areas
+typedef enum {
+    NONE_PRESS,
+    CURR_TEMP_PRESS,
+    CURR_HUM_PRESS,
+    STAT_TEMP_PRESS,
+    STAT_HUM_PRESS,
+    ZONE_1_PRESS,
+    ZONE_2_PRESS,
+    ZONE_3_PRESS,
+    ZONE_4_PRESS,
+    ZONE_5_PRESS,
+    ZONE_6_PRESS,
+    ZONE_7_PRESS,
+    ZONE_8_PRESS,
+    ABOUT_PRESS,
+    MENU_PRESS,
+} pressValues;
+
+// all screens available in app
+typedef enum {
+    MENU_SCREEN,
+    CURR_HUM_SCREEN,
+    CURR_TEMP_SCREEN,
+    ABOUT_SCREEN,
+    HUM_24HRS_SCREEN,
+    HUM_3HRS_SCREEN,
+    HUM_30MIN_SCREEN,
+    TEMP_24HRS_SCREEN,
+    TEMP_3HRS_SCREEN,
+    TEMP_30MIN_SCREEN
+} screenValues;
+
+
+/**************************************************************************************************************************
+************************** User class for drawing at FT800 ****************************************************************
+**************************************************************************************************************************/
+
+class Display
+{
+public:
+    // in Display class we use FT800 TFT (definition is available in main.cpp)
+    Display(FT800 *TFT) {
+        _TFT = TFT;
+    }
+
+    // functions describing all available screens (screens-functions)
+    void MainMenu(float humidity, float temperature);                   // [display.Draw_MainMenu.cpp]
+    void CurrentHumidity(float humidity);                               // [display.Draw_CurrentValues.cpp]
+    void CurrentTemperature(float temperature);                         // [display.Draw_CurrentValues.cpp]
+    void StatHumidity_24hrs(volatile uint64_t seconds, short int statistics24hrs[3][288], 
+                                uint64_t gridSecondsOffset);            // [display.Draw_24hrsStatistics.cpp]                
+    void StatTemperature_24hrs(volatile uint64_t seconds, short int statistics24hrs[3][288], 
+                                uint64_t gridSecondsOffset);            // [display.Draw_24hrsStatistics.cpp]              
+    void StatHumidity_3hrs(volatile uint64_t seconds, short int statistics24hrs[3][288],
+                                uint64_t gridSecondsOffset);            // [display.Draw_3hrsStatistics.cpp]      
+    void StatTemperature_3hrs(volatile uint64_t seconds, short int statistics24hrs[3][288], 
+                                uint64_t gridSecondsOffset);            // [display.Draw_3hrsStatistics.cpp]   
+    void StatHumidity_30min(volatile uint64_t seconds, short int statistics24hrs[3][288],
+                                uint64_t gridSecondsOffset);            // [display.Draw_30minStatistics.cpp]      
+    void StatTemperature_30min(volatile uint64_t seconds, short int statistics24hrs[3][288], 
+                                uint64_t gridSecondsOffset);            // [display.Draw_30minStatistics.cpp]      
+    void AboutSensor(void);                                             // [display.Draw_AboutSensor.cpp]
+
+    // functions using to prepare FT800 / FT801
+    void LoadImagesAndFonts(void);                                      // [display.LoadImagesAndFonts.cpp]
+    void HandleAllBitmaps(void);                                      // [display.LoadImagesAndFonts.cpp]
+    void Calibration(void);                                             // [display.Calibration.cpp]
+    
+    // function for touchscreen tracking
+    char GetTouch(void);                                                // [display.GetTouch.cpp]    
+    
+    // variables using for navigation between screens
+    char pressedButton;
+    char activeScreen;
+    char timePoint3hrs, timePoint30min;
+
+private:
+    FT800 *_TFT;
+
+    // For start and end every display list (every screen)
+    void StartDL(void);                                                 // [display.DisplayListFunctions.cpp]
+    void FinishDL(void);                                                // [display.DisplayListFunctions.cpp]
+    
+    // Utility function for drawing
+    void MainMenuReference(void);                                       // [display.Draw_MainMenuReference.cpp]
+    void TimeSinceTurnOn(uint64_t seconds);                             // [display.Draw_TimeSinceTurnOn.cpp]
+    void HorisontalGrid_Current_Temperature(void);                      // [display.Draw_Grids.cpp]
+    void HorisontalGrid_Current_Humidity(void);                         // [display.Draw_Grids.cpp]
+    void HorisontalGrid_Statistics_Temperature(void);                   // [display.Draw_Grids.cpp]
+    void HorisontalGrid_Statistics_Humidity(void);                      // [display.Draw_Grids.cpp]
+    void VerticalGrid3hrs(uint64_t gridSecondsOffset);                  // [display.Draw_Grids.cpp]
+    void VerticalGrid24hrs(uint64_t gridSecondsOffset);                 // [display.Draw_Grids.cpp]
+    void VerticalGrid30min(uint64_t gridSecondsOffset);                 // [display.Draw_Grids.cpp]
+
+    // String operations
+    char CreateStringTempHum(char *str, float number, bool isTemp);     // [display.StringsTransform.cpp]
+    void CreateStringMultipliedTemp(char *str, short int number);       // [display.StringsTransform.cpp]
+    void CreateStringTime(char *str, uint32_t numberOfSeconds);         // [display.StringsTransform.cpp]
+
+    // String variables 
+    char humidityStr[8], temperatureStr[8];
+    char timeStr[9], gridTimeStr[9];
+    
+    // Variables for managing graphs with current temperature or humidity
+    char currentHumidity_X, currentTemperature_X;
+    char currentHumidity_Y[68], currentTemperature_Y[68];
+};
+
+#endif /* SCREENS_H_ */
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,152 @@
+#include "mbed.h"
+#include "FT_Platform.h"
+#include "HYT.h"
+#include "display.h"
+#include "statistics.h"
+
+Ticker timeKeeping;
+volatile uint64_t seconds = 0;
+uint64_t secondsOffset = 0;
+
+HYT SENSOR (PD6, PD7); // sda, scl [SLSTK3400A]
+FT800 TFT (PE10, PE11, PE12, PE13, PB11, PD4); // mosi, miso, sck, ss, int, pd [SLSTK3400A]
+//HYT SENSOR (D14, D15); // sda, scl [WIZwiki-W7500P]
+//FT800 TFT (D11, D12, D13, D10, D9, D8); // mosi, miso, sck, ss, int, pd [WIZwiki-W7500P]
+//HYT SENSOR (PA08, PA09); // sda, scl [ATSAMD21-XPRO]
+//FT800 TFT (PA18, PA16, PA19, PA17, PA20, PA21); // mosi, miso, sck, ss, int, pd [ATSAMD21-XPRO]
+
+Display disp(&TFT);
+Statistics stat;
+
+/**************************************************************************************************************************
+************************** Update statistics data every second ************************************************************
+**************************************************************************************************************************/
+void secondsCallback(void)
+{
+    if (seconds != 0) {
+        secondsOffset = stat.UpdateStatistics(SENSOR.humidity, SENSOR.temperature, seconds, secondsOffset);
+    } else {
+        stat.InitValues(SENSOR.humidity, SENSOR.temperature);
+    }
+    seconds ++;
+}
+
+/**************************************************************************************************************************
+************************** HYT sensor polling cycle ***********************************************************************
+**************************************************************************************************************************/
+void dataUpdate(void)
+{
+    SENSOR.MRCommand();
+    wait_ms(100);
+    SENSOR.DFCommand();
+}
+
+/**************************************************************************************************************************
+************************** Main function **********************************************************************************
+**************************************************************************************************************************/
+int main()
+{
+    timeKeeping.attach(&secondsCallback, 1.0f);
+
+    disp.LoadImagesAndFonts();
+    disp.HandleAllBitmaps();
+    disp.Calibration();
+
+    disp.activeScreen = MENU_SCREEN;
+    disp.pressedButton = NONE_PRESS;
+
+    //  change active screen depending on pressed area
+    while(1) {
+        dataUpdate();
+        disp.pressedButton = disp.GetTouch();
+
+        // ----------------------------------------------------------------------------------------------
+        // Main menu screen
+        if (disp.activeScreen == MENU_SCREEN) {
+            disp.MainMenu(SENSOR.humidity, SENSOR.temperature);
+            if (disp.pressedButton) {
+                wait_ms(150);
+                if (disp.pressedButton == CURR_TEMP_PRESS) {
+                    disp.activeScreen = CURR_TEMP_SCREEN;
+                } else if (disp.pressedButton == CURR_HUM_PRESS) {
+                    disp.activeScreen = CURR_HUM_SCREEN;
+                } else if (disp.pressedButton == STAT_HUM_PRESS) {
+                    disp.activeScreen = HUM_24HRS_SCREEN;
+                } else if (disp.pressedButton == STAT_TEMP_PRESS) {
+                    disp.activeScreen = TEMP_24HRS_SCREEN;
+                } else if (disp.pressedButton == ABOUT_PRESS) {
+                    disp.activeScreen = ABOUT_SCREEN;
+                }
+                disp.pressedButton = NONE_PRESS;
+            }
+
+        // ----------------------------------------------------------------------------------------------
+        // Any other screen
+        } else {
+            // ----------------------------------------------------------------------------------------------
+            // You can back to main menu from any screen
+            if (disp.pressedButton == MENU_PRESS) {
+                disp.pressedButton = NONE_PRESS;
+                disp.activeScreen = MENU_SCREEN;
+            } else {
+                // ----------------------------------------------------------------------------------------------
+                // Screen with current temperature
+                if (disp.activeScreen == CURR_TEMP_SCREEN) {
+                    disp.CurrentTemperature(SENSOR.temperature);
+                // ----------------------------------------------------------------------------------------------
+                // Screen with current humidity
+                } else if (disp.activeScreen == CURR_HUM_SCREEN) {
+                    disp.CurrentHumidity(SENSOR.humidity);
+                // ----------------------------------------------------------------------------------------------
+                // Screens with humidity statistics
+                } else if (disp.activeScreen == HUM_24HRS_SCREEN) {
+                    disp.StatHumidity_24hrs(seconds, stat.humidity24hrs, secondsOffset);
+                    if (disp.pressedButton >= ZONE_1_PRESS && disp.pressedButton <= ZONE_8_PRESS) {
+                        wait_ms(150);
+                        disp.activeScreen = HUM_3HRS_SCREEN;
+                        disp.pressedButton = NONE_PRESS;
+                    }
+                } else if (disp.activeScreen == HUM_3HRS_SCREEN) {
+                    disp.StatHumidity_3hrs(seconds, stat.humidity24hrs, secondsOffset);
+                    if (disp.pressedButton >= ZONE_1_PRESS && disp.pressedButton <= ZONE_6_PRESS) {
+                        wait_ms(150);
+                        disp.activeScreen = HUM_30MIN_SCREEN;
+                        disp.pressedButton = NONE_PRESS;
+                    }
+                } else if (disp.activeScreen == HUM_30MIN_SCREEN) {
+                    disp.StatHumidity_30min(seconds, stat.humidity24hrs, secondsOffset);
+                    if (disp.pressedButton == STAT_HUM_PRESS) {
+                        disp.activeScreen = HUM_24HRS_SCREEN;
+                        disp.pressedButton = NONE_PRESS;
+                    }
+                // ----------------------------------------------------------------------------------------------
+                // Screens with humidity statistics
+                } else if (disp.activeScreen == TEMP_24HRS_SCREEN) {
+                    disp.StatTemperature_24hrs(seconds, stat.temperature24hrs, secondsOffset);
+                    if (disp.pressedButton >= ZONE_1_PRESS && disp.pressedButton <= ZONE_8_PRESS) {
+                        wait_ms(150);
+                        disp.activeScreen = TEMP_3HRS_SCREEN;
+                        disp.pressedButton = NONE_PRESS;
+                    }
+                } else if (disp.activeScreen == TEMP_3HRS_SCREEN) {
+                    disp.StatTemperature_3hrs(seconds, stat.temperature24hrs, secondsOffset);
+                    if (disp.pressedButton >= ZONE_1_PRESS && disp.pressedButton <= ZONE_6_PRESS) {
+                        wait_ms(150);
+                        disp.activeScreen = TEMP_30MIN_SCREEN;
+                        disp.pressedButton = NONE_PRESS;
+                    }
+                } else if (disp.activeScreen == TEMP_30MIN_SCREEN) {
+                    disp.StatTemperature_30min(seconds, stat.temperature24hrs, secondsOffset);
+                    if (disp.pressedButton == STAT_TEMP_PRESS) {
+                        disp.activeScreen = TEMP_24HRS_SCREEN;
+                        disp.pressedButton = NONE_PRESS;
+                    }
+                // ----------------------------------------------------------------------------------------------
+                // Screens with information about sensor
+                } else if (disp.activeScreen == ABOUT_SCREEN) {
+                    disp.AboutSensor();
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pictures.h	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,15 @@
+
+#define IMAGE_ADDR_HUMIDITY 40000
+const unsigned char hum_icon[]={
+120,156,165,86,203,109,195,48,12,205,177,40,250,25,193,35,120,4,141,160,17,60,130,71,200,181,55,143,224,123,46,26,193,11,20,208,4,133,54,168,71,96,31,165,248,43,74,145,82,18,8,20,138,79,228,35,41,193,244,73,117,218,86,250,175,250,251,65,243,115,200,203,133,88,236,83,232,153,130,92,171,145,29,109,82,135,108,214,168,44,117,172,29,209,1,59,22,35,21,197,82,91,165,125,100,45,121,254,188,147,33,131,94,110,255,37,17,177,52,248,189,149,209,247,155,136,85,2,82,195,238,124,109,186,213,102,132,156,83,189,80,152,91,222,111,130,213,207,226,94,92,60,93,152,186,137,150,185,185,98,53,193,178,229,51,223,53,194,121,237,217,255,235,133,215,248,229,115,250,195,126,11,109,68,228,33,79,159,63,75,251,184,135,224,228,162,202,247,167,188,83,58,238,251,178,106,156,119,162,51,219,60,36,121,164,59,35,237,113,189,77,6,107,40,121,163,49,85,46,121,110,200,215,194,39,199,199,74,59,152,116,247,176,19,83,34,242,85,172,111,28,57,226,140,76,185,74,185,58,6,117,130,151,46,136,186,100,215,9,54,93,128,85,240,27,78,182,49,83,255,189,54,2,227,255,96,37,30,146,106,33,103,85,88,171,49,142,113,123,45,234,145,191,17,194,228,249,59,138,233,74,34,113,187,172,204,236,254,182,76,194,253,91,170,100,211,188,128,154,252,219,167,197,26,49,39,147,190,41,216,9,239,185,5,131,150,253,192,65,161,7,206,91,135,240,250,101,84,249,232,103,49,197,95,24,13,226,26,68,183,56,103,196,58,91,255,63,65,221,118,198,
+};
+
+#define IMAGE_ADDR_TEMPERATURE 50000
+const unsigned char temp_icon[]={
+120,156,197,84,193,113,133,32,16,253,199,76,38,201,47,129,18,44,129,18,44,129,18,44,129,107,110,150,224,61,23,75,176,129,204,88,65,134,14,66,9,47,79,132,85,62,232,152,75,2,7,101,121,176,111,223,46,139,59,246,83,161,199,12,15,135,1,13,238,135,179,37,102,70,199,175,193,8,192,30,226,64,84,190,54,85,228,76,207,185,197,146,69,137,83,188,65,93,176,221,161,105,45,207,131,246,90,52,37,210,211,126,13,233,126,129,44,163,191,142,172,71,84,227,185,33,53,119,213,9,178,1,110,183,240,55,237,114,115,128,252,126,139,187,144,108,249,138,158,42,67,14,56,86,126,203,220,63,32,201,241,175,188,31,232,249,245,42,200,49,90,207,43,100,65,78,241,127,170,188,58,203,119,148,184,109,200,65,120,108,115,150,211,203,72,167,12,252,199,115,134,235,82,60,65,45,36,38,92,249,195,151,173,3,50,213,192,186,151,148,82,187,142,208,134,120,86,255,77,180,245,112,145,193,32,252,59,228,67,11,3,19,121,233,164,232,195,112,159,47,241,174,113,245,247,254,20,215,229,104,163,2,46,120,76,138,204,21,164,77,81,146,233,57,178,223,213,132,145,126,86,243,110,82,4,140,103,123,105,186,140,40,214,76,168,9,190,92,47,170,219,154,74,18,123,232,167,241,236,26,229,58,38,81,94,237,148,117,89,197,40,218,165,191,210,231,36,153,89,24,123,12,146,233,124,246,220,219,247,229,134,247,178,190,31,208,138,252,138,46,66,166,54,86,187,37,91,195,187,166,140,109,54,153,213,54,32,150,251,151,19,25,234,7,61,209,125,245,
+};
+
+#define IMAGE_ADDR_SENSOR 0
+const unsigned char HYT_photo[]={
+120,156,237,93,111,144,19,101,154,7,63,157,160,139,201,232,33,224,135,5,220,15,39,127,39,25,20,71,246,203,42,114,87,130,112,36,184,194,224,135,93,93,5,87,192,213,140,202,2,85,115,187,115,26,33,51,211,236,246,12,45,213,161,232,186,107,220,86,154,153,102,47,3,97,47,169,162,171,174,213,214,109,102,218,181,7,67,109,79,149,249,16,37,98,102,38,30,25,205,150,220,243,188,111,50,51,233,4,92,239,214,14,86,221,219,53,136,153,12,246,175,159,231,249,253,126,207,243,190,193,43,87,234,179,236,98,52,159,44,92,41,214,233,63,255,55,95,251,114,63,204,60,150,217,151,61,146,179,11,245,190,151,255,251,178,139,243,210,135,205,195,198,95,82,171,210,251,178,251,114,137,188,253,157,142,84,52,151,178,172,120,183,98,197,87,170,103,204,59,134,87,101,182,2,170,100,254,187,154,127,171,210,143,234,173,114,80,10,73,33,57,166,204,78,238,214,47,88,128,42,253,88,246,72,254,187,151,127,118,161,152,186,28,15,73,65,114,133,164,110,185,91,182,98,179,147,191,52,138,144,127,24,169,104,126,248,59,20,169,189,185,195,230,127,40,136,39,64,240,208,139,133,72,89,177,149,218,25,19,171,106,107,102,111,246,59,82,85,197,59,210,43,213,144,28,156,130,101,242,234,6,84,133,248,163,218,31,32,255,144,255,162,185,235,157,213,19,249,11,41,11,179,77,116,226,177,226,175,25,31,196,67,50,137,85,140,86,21,212,20,162,186,142,243,111,107,118,183,209,141,209,169,192,131,255,190,89,63,109,29,50,206,88,247,168,172,18,148,90,33,86,31,196,86,170,175,25,69,27,248,15,80,37,175,67,84,195,197,162,61,59,73,162,51,129,135,240,130,24,18,95,51,46,242,247,135,51,252,72,156,51,95,50,62,136,61,15,245,5,25,8,249,183,89,75,65,254,129,2,35,171,95,87,249,183,47,119,198,140,41,228,254,203,72,224,174,3,162,95,136,41,119,107,171,195,211,218,166,181,205,111,107,103,30,146,130,218,107,38,68,74,70,220,108,153,213,83,119,0,83,108,133,252,187,94,88,125,94,250,81,45,36,211,232,4,39,98,227,135,107,179,246,176,180,160,29,241,76,107,251,62,124,45,104,127,139,59,23,59,100,236,38,145,66,252,152,127,179,213,195,192,234,63,4,76,123,129,43,234,141,42,89,184,0,202,67,49,208,124,163,191,243,11,172,188,89,127,133,153,222,62,189,109,122,219,180,118,188,166,183,35,174,199,35,55,10,62,149,51,238,81,99,74,0,114,178,85,238,86,46,3,255,1,171,219,63,76,163,175,56,82,71,87,241,88,246,48,201,182,192,132,150,6,69,200,53,209,43,92,78,252,62,190,176,20,29,122,205,111,159,252,221,49,182,75,129,72,233,101,22,233,150,251,161,170,94,210,83,214,188,97,170,192,201,66,29,184,2,92,232,164,242,208,123,11,0,158,38,64,180,91,207,242,11,218,166,93,229,154,14,53,165,177,183,169,94,193,79,226,218,90,210,42,116,21,135,169,171,200,172,202,182,100,221,133,19,205,167,82,86,44,88,242,5,152,103,1,242,213,0,92,48,91,93,29,158,126,53,52,237,136,104,134,176,65,26,229,27,132,169,181,135,254,143,184,90,237,66,106,85,230,190,140,187,120,182,102,118,27,172,92,174,29,188,154,72,108,188,194,74,109,151,180,128,196,225,106,17,250,81,251,14,201,96,199,0,143,127,226,167,201,147,129,231,17,146,98,202,107,198,29,233,125,57,55,209,36,193,133,206,86,67,83,208,32,30,63,68,39,32,61,170,135,153,249,165,90,153,223,94,141,230,251,109,199,216,93,242,57,206,228,0,143,16,16,203,213,135,49,242,3,162,152,242,7,107,94,218,221,10,34,202,19,163,79,148,34,242,19,158,110,0,46,88,161,93,61,219,16,205,252,246,181,226,122,241,28,55,200,97,5,33,130,9,62,65,60,82,33,81,76,185,93,61,208,243,104,168,142,165,123,33,153,230,23,26,224,58,108,126,158,88,19,249,89,248,103,145,133,237,181,81,61,17,233,146,111,142,246,114,99,60,197,51,137,8,255,36,86,222,173,207,27,142,230,221,68,147,44,245,60,244,78,2,19,104,198,248,231,229,51,214,195,210,131,145,153,81,37,182,94,126,135,91,29,190,161,10,213,199,252,122,73,102,7,57,90,63,149,104,130,210,7,49,146,109,110,194,185,178,143,42,143,72,178,77,162,121,134,104,12,246,191,227,143,104,58,247,58,243,49,183,67,26,140,223,154,124,63,182,84,12,51,24,41,170,168,232,20,150,136,199,217,94,214,156,130,167,28,101,100,131,149,234,95,236,173,238,102,91,113,21,42,79,185,118,74,145,25,224,58,216,247,184,77,218,78,233,201,200,253,225,199,225,235,45,182,79,89,161,174,208,110,77,50,242,69,136,212,2,194,14,34,179,68,140,176,189,156,137,104,202,241,17,75,60,9,217,6,220,54,156,116,213,249,68,177,231,137,81,159,134,151,55,58,200,29,103,183,69,126,0,53,243,54,247,0,185,239,199,35,200,109,79,68,214,138,222,228,10,109,133,250,121,66,81,178,252,157,237,11,218,23,139,239,113,93,172,194,189,95,137,71,68,182,15,138,86,28,181,199,77,52,84,121,66,114,153,207,70,249,19,236,211,204,234,240,194,240,130,240,124,184,95,188,230,79,92,63,10,107,236,90,105,173,184,88,220,37,103,249,213,225,153,2,35,71,24,6,240,228,75,120,154,68,26,25,63,201,182,71,181,121,195,238,42,143,93,152,55,60,59,137,85,131,53,115,142,219,78,176,44,4,20,128,200,129,134,94,11,218,239,15,255,43,115,140,125,133,125,133,25,139,47,21,59,1,141,201,231,143,86,227,137,41,103,76,247,149,39,110,118,43,136,102,140,63,193,109,131,58,161,40,22,150,98,227,196,243,253,9,68,47,51,139,196,124,226,56,139,217,134,92,221,64,208,148,241,4,235,162,60,95,129,242,172,212,2,20,13,212,204,157,16,21,122,45,8,151,177,76,175,138,16,246,13,132,31,98,235,165,3,76,111,153,171,43,170,7,122,34,121,179,86,180,221,87,30,43,230,23,199,248,14,238,65,18,155,18,154,82,100,166,87,96,168,252,253,141,194,88,226,85,102,63,67,227,67,185,58,56,137,71,178,98,152,109,110,162,33,61,143,17,146,188,194,9,110,13,48,216,194,240,15,194,11,39,178,172,156,105,212,183,77,197,51,17,33,238,206,246,109,145,142,82,190,249,133,73,60,65,162,60,197,148,187,202,51,92,188,35,61,59,233,23,7,249,237,17,188,251,133,232,106,194,180,118,166,222,57,233,75,75,255,156,124,141,114,195,3,225,55,217,129,41,249,230,39,238,162,73,236,86,94,51,231,185,172,60,71,242,23,172,110,197,43,200,236,106,154,105,237,11,194,149,44,80,70,51,245,194,87,41,22,26,197,39,35,57,202,6,36,62,20,19,42,79,202,125,229,201,110,214,155,196,65,110,205,68,150,45,172,200,180,73,60,78,100,147,220,141,63,163,115,27,165,6,97,50,66,193,146,242,68,221,238,121,236,203,241,91,133,94,238,129,18,130,202,200,208,95,167,77,100,218,212,185,65,25,17,121,119,219,43,204,63,79,197,3,191,214,71,121,206,152,33,25,152,141,93,56,149,139,9,167,77,198,100,218,148,202,153,58,15,153,204,184,249,109,247,183,191,87,86,32,68,4,61,221,223,39,47,184,204,5,208,243,100,80,121,70,249,159,51,149,154,57,153,85,83,103,30,149,93,2,121,87,25,81,219,194,246,55,65,131,188,81,130,7,174,144,252,40,40,207,17,119,149,39,95,76,125,16,243,11,3,220,63,69,230,79,212,67,173,233,141,19,73,165,247,161,245,182,157,65,60,136,5,49,197,64,121,238,72,187,59,121,107,201,188,6,46,180,33,58,0,30,103,254,4,11,215,198,83,253,250,84,86,64,76,219,34,147,156,29,20,81,121,246,185,154,109,118,113,238,240,108,53,0,189,65,31,187,38,50,173,109,250,85,241,92,45,82,149,250,250,84,9,15,186,132,144,124,216,112,91,121,246,229,192,230,16,159,211,197,62,24,46,227,185,22,154,90,145,42,59,212,233,109,15,78,193,3,202,99,185,61,109,155,151,126,73,15,1,199,154,19,120,166,253,85,241,153,94,243,149,233,109,171,195,136,7,25,33,8,202,243,101,202,117,229,73,93,142,227,172,208,228,38,241,92,59,58,211,218,166,87,93,37,126,159,192,131,17,98,229,195,224,115,220,85,158,173,217,51,216,243,64,143,128,120,214,68,166,127,3,60,85,30,136,252,251,147,225,94,14,187,6,191,120,25,58,236,173,238,102,91,241,142,225,149,90,80,194,158,71,225,58,217,109,76,105,31,228,175,192,83,102,141,169,136,112,198,243,42,211,199,154,208,115,7,165,205,174,43,207,17,80,30,139,100,219,24,127,18,241,68,230,127,13,146,73,127,83,219,161,62,16,62,128,61,55,196,167,91,57,108,186,61,109,91,69,148,7,209,152,16,159,14,22,123,133,107,97,41,99,168,172,162,114,188,240,251,219,35,189,236,73,194,111,133,132,219,62,199,46,254,197,158,173,6,33,58,121,192,211,203,118,176,7,152,7,195,55,92,3,81,165,214,58,251,33,228,234,78,182,143,84,79,80,122,73,47,166,220,85,158,189,217,51,68,121,26,132,252,81,100,235,14,166,131,125,154,89,248,181,213,115,53,174,91,216,254,115,134,225,78,146,221,5,112,213,22,118,216,95,185,136,231,62,220,243,149,232,60,87,225,48,62,93,108,39,251,143,145,175,83,211,218,120,110,104,219,22,161,243,42,228,182,219,213,47,83,123,221,85,30,224,130,203,49,194,5,16,29,6,144,224,221,40,128,106,205,53,246,68,106,225,161,95,119,134,35,44,50,155,73,149,199,40,218,238,158,234,217,154,61,108,178,178,95,64,54,24,228,49,50,189,4,15,195,70,190,113,206,149,152,128,240,26,120,107,84,30,203,93,229,25,46,206,27,94,169,6,32,219,188,81,156,184,247,66,174,245,193,179,29,4,68,93,192,115,223,12,209,252,182,7,195,165,217,78,212,43,96,135,93,76,185,59,109,163,147,119,58,61,28,227,251,184,19,128,98,16,158,175,73,240,116,128,18,93,155,185,167,102,219,180,182,251,195,7,64,69,241,79,194,206,52,6,202,83,180,221,100,2,156,188,31,54,32,219,112,82,29,53,33,58,39,202,209,33,120,58,129,185,183,93,117,23,174,146,11,48,215,94,102,78,144,201,40,221,151,155,237,122,135,141,243,15,220,231,41,239,239,244,146,201,51,106,170,194,33,154,8,224,65,68,119,126,13,51,80,29,125,34,178,159,233,227,198,184,6,210,101,183,202,187,245,47,93,86,158,125,185,11,86,127,172,188,95,213,7,76,128,251,28,39,1,205,65,112,61,6,191,65,122,19,16,109,103,158,138,60,24,198,93,159,218,168,166,183,225,12,241,137,200,43,76,39,107,98,229,68,73,207,19,251,131,235,179,221,251,210,187,245,86,220,231,1,118,27,132,232,244,66,182,41,4,13,3,181,243,11,121,94,250,253,248,167,252,126,118,59,96,122,21,226,180,38,178,58,188,176,253,134,41,110,7,177,172,14,111,139,108,103,94,97,36,82,59,13,100,207,56,72,102,187,46,43,15,158,48,40,237,243,0,87,19,60,16,29,200,54,6,242,238,56,123,80,73,230,31,203,190,31,223,79,208,236,135,204,123,26,126,183,61,178,13,174,53,225,7,201,181,38,178,61,114,0,252,196,126,38,204,28,71,63,125,148,118,164,184,171,232,182,242,60,134,62,71,33,217,22,29,227,48,219,80,7,145,11,80,85,255,200,153,241,173,217,91,213,23,245,21,234,77,2,68,32,242,52,224,57,64,174,253,4,29,94,29,68,127,59,216,48,68,231,92,185,191,22,2,226,229,196,5,151,59,108,60,243,190,89,11,145,232,148,179,77,225,144,171,21,146,109,151,248,131,202,11,250,11,122,209,126,88,122,139,59,198,190,206,189,14,119,253,52,243,38,251,38,251,6,139,117,133,190,136,97,15,194,175,17,248,206,27,192,108,52,215,252,168,60,224,66,221,237,121,162,249,47,161,231,9,18,52,99,71,21,174,143,195,126,210,36,29,3,102,219,37,254,102,225,100,108,133,122,50,38,113,143,71,254,133,249,21,243,239,236,127,177,139,196,75,252,27,204,18,97,133,58,75,232,96,16,15,67,88,125,63,35,179,229,232,248,197,254,216,25,115,238,176,187,211,54,80,30,226,115,240,30,176,75,232,101,7,8,26,147,195,39,46,115,239,113,18,163,179,55,9,55,9,47,51,63,141,252,148,249,9,243,147,200,191,177,207,72,249,196,6,233,243,248,139,250,50,17,227,115,144,224,65,71,94,158,230,248,132,128,116,187,235,251,60,201,194,188,225,123,212,160,132,58,158,7,46,56,193,226,30,225,36,158,8,60,241,87,153,39,35,171,35,175,51,63,139,252,180,116,29,99,63,225,27,212,207,19,191,85,62,227,142,3,14,166,132,167,179,180,155,77,163,19,146,127,105,124,105,187,221,243,224,180,173,169,116,234,163,196,5,60,117,6,180,34,128,213,34,160,59,192,208,184,67,135,231,39,30,7,60,139,196,160,158,143,207,18,144,11,58,75,213,131,207,194,36,187,113,229,105,27,112,129,187,202,83,68,229,9,81,159,3,92,208,71,116,148,212,14,95,118,6,136,135,178,243,83,128,233,78,192,180,48,252,54,151,229,151,137,203,132,227,236,254,18,30,100,118,116,176,101,221,241,11,207,75,43,93,223,243,141,66,207,83,72,4,75,231,165,6,185,46,130,71,41,161,233,32,46,7,181,134,114,51,198,105,13,137,212,3,160,56,219,35,239,113,151,248,253,76,132,45,179,65,231,4,179,53,144,125,30,156,237,186,59,109,107,201,224,169,234,38,145,118,61,125,248,132,225,158,20,158,42,143,204,221,166,206,18,223,100,95,45,169,204,126,18,37,252,90,3,58,250,84,36,203,47,21,39,163,211,1,217,54,177,211,35,4,197,2,40,143,187,187,138,118,97,238,240,74,45,64,58,108,47,184,234,62,64,51,233,66,59,216,101,226,143,245,223,40,199,185,253,68,63,35,240,5,153,23,217,31,65,21,197,168,237,103,202,218,131,232,79,144,232,120,233,62,15,112,193,110,215,149,103,43,112,129,21,163,61,2,157,24,208,254,248,36,48,1,68,135,93,47,189,168,191,100,124,158,56,25,215,185,109,232,112,152,18,50,168,170,14,114,117,150,208,96,165,245,149,78,137,210,157,197,58,156,48,40,206,29,6,46,192,30,33,138,76,221,71,123,132,9,95,112,156,125,88,124,81,143,155,43,180,46,229,109,240,5,199,216,167,32,62,16,19,246,0,241,4,29,44,205,52,134,160,239,44,239,204,139,36,219,164,123,84,183,123,158,104,254,195,212,7,56,11,141,162,7,237,67,46,224,20,110,146,167,47,65,117,156,140,13,198,119,202,119,9,191,102,126,141,174,0,80,205,16,116,238,93,238,83,254,61,46,66,240,40,108,31,201,182,94,118,116,66,119,252,98,55,153,127,184,171,60,205,233,67,230,65,101,150,144,131,254,13,251,235,78,210,97,43,37,23,122,128,253,148,127,151,203,114,51,162,119,9,111,115,237,204,175,217,95,129,211,249,59,177,55,166,196,150,1,206,215,204,101,34,213,29,124,18,189,37,166,166,123,164,77,226,16,40,207,188,180,155,29,182,93,60,159,234,49,91,141,47,236,15,83,43,180,101,224,198,142,83,110,227,80,233,129,169,89,228,181,48,51,67,120,135,59,198,60,1,78,231,87,240,245,241,209,181,210,11,198,75,198,109,234,159,18,159,241,4,15,160,239,101,241,4,111,131,80,62,245,71,231,31,238,158,109,219,147,235,183,198,83,248,89,223,100,193,46,246,91,111,64,60,6,184,50,30,218,97,147,126,20,186,205,213,17,236,58,49,231,142,177,157,74,143,241,161,245,167,248,103,252,113,226,218,40,158,222,50,23,76,158,48,112,89,121,198,237,110,35,168,159,178,78,195,53,4,207,114,189,188,68,244,137,131,188,66,114,175,131,224,121,186,212,179,97,151,253,131,48,98,186,120,116,32,118,200,224,140,13,210,113,248,62,113,161,165,108,35,103,246,74,92,48,59,121,193,106,113,85,121,18,133,126,171,213,24,75,116,41,59,229,193,120,159,114,218,52,99,235,161,3,26,227,70,249,70,241,102,225,93,14,89,236,231,164,95,131,171,212,135,174,14,163,43,205,39,126,163,92,226,81,143,202,202,131,14,150,234,40,50,66,72,126,9,122,165,164,171,202,211,156,233,49,3,218,104,124,135,188,72,156,33,44,18,238,214,20,229,57,9,153,206,39,222,173,157,182,190,180,79,91,239,39,142,115,7,38,250,208,237,20,83,228,201,200,96,236,89,25,207,234,149,93,40,193,51,197,133,66,207,131,147,119,23,179,109,184,56,148,10,234,94,213,155,4,44,192,88,139,197,124,124,151,228,19,77,110,148,251,141,220,146,217,154,93,149,57,101,109,205,114,38,176,4,135,74,19,153,192,244,42,243,126,124,25,120,160,200,132,207,233,156,226,66,241,83,36,56,121,119,87,121,246,2,23,4,180,30,243,124,106,145,248,50,243,54,183,88,84,20,252,76,139,194,142,30,253,133,108,198,126,172,191,104,124,152,26,178,230,166,151,8,203,132,115,124,39,173,39,194,16,79,51,207,201,191,85,100,142,170,105,87,137,229,39,92,53,250,28,215,123,158,57,233,86,224,130,57,233,35,249,86,163,55,118,145,223,41,237,146,26,69,96,2,214,35,44,19,111,138,62,43,239,146,253,234,64,252,180,249,172,188,92,28,229,161,226,185,207,248,63,242,7,176,119,96,62,227,99,241,19,28,117,58,232,242,176,95,154,196,131,61,207,92,87,125,14,178,243,88,98,32,142,159,117,77,22,246,229,214,73,131,192,5,35,224,174,7,184,229,226,195,226,58,113,177,184,72,188,49,58,83,184,53,249,172,236,17,144,241,150,139,135,204,211,214,139,198,173,234,82,233,123,130,193,77,186,208,14,150,206,169,41,158,64,29,148,167,37,219,109,238,144,67,198,112,241,43,168,217,83,214,46,185,75,89,46,130,71,0,85,92,47,62,44,237,146,47,242,207,192,107,51,133,65,112,2,3,160,71,240,165,220,151,30,140,143,38,246,230,128,217,165,79,249,19,28,58,29,234,170,123,75,147,234,210,9,3,215,123,158,161,84,171,225,85,239,203,30,201,39,243,251,178,207,42,15,75,235,196,91,4,236,21,114,252,18,113,44,209,164,255,142,125,153,125,135,91,44,236,146,102,9,56,201,30,225,25,105,44,113,183,238,215,198,83,201,130,25,207,242,27,164,65,112,225,125,128,231,56,139,187,86,131,136,231,40,238,243,184,125,158,37,81,232,177,188,106,131,138,19,181,67,70,151,178,88,88,7,25,54,194,163,103,185,196,95,228,134,82,171,50,77,218,90,73,231,111,18,150,138,57,30,119,26,102,9,59,197,29,210,78,185,47,214,164,158,79,61,162,175,147,158,147,240,188,133,87,184,116,20,189,233,9,200,72,220,185,10,136,228,60,139,171,202,195,231,251,1,207,96,124,166,64,170,4,180,103,177,240,48,201,182,17,254,93,246,19,158,207,99,133,109,205,222,44,238,148,150,138,231,80,253,161,122,110,130,119,205,20,102,8,23,185,177,248,173,201,13,200,237,188,55,250,156,220,164,157,178,190,176,57,115,185,116,14,148,152,149,207,0,183,185,137,198,46,178,102,191,213,111,245,42,119,193,221,221,37,62,36,206,20,118,74,27,68,140,206,247,132,223,49,163,113,168,42,120,223,33,115,9,224,249,30,201,54,131,191,25,34,149,229,223,230,158,145,215,137,93,242,65,165,81,196,108,243,10,143,232,137,252,220,52,230,215,190,28,58,245,63,197,63,180,220,61,195,191,37,187,81,31,183,231,166,7,226,157,202,90,233,92,236,28,56,132,94,133,145,111,17,150,139,75,132,79,184,243,86,18,28,234,214,220,18,113,145,48,51,122,14,153,26,178,109,137,240,97,106,151,242,59,238,101,54,203,173,3,6,132,106,3,223,218,40,110,210,130,218,109,234,38,157,207,37,11,155,244,155,132,23,116,248,121,87,149,167,223,10,26,167,204,6,117,173,180,67,62,17,195,169,255,150,172,95,27,140,153,177,147,177,181,226,90,209,175,6,181,67,102,39,112,219,34,225,230,232,9,200,54,3,56,175,75,217,151,59,111,141,198,23,139,51,163,59,37,228,118,6,56,111,131,116,80,89,7,85,213,27,11,106,169,212,139,6,163,156,50,199,83,110,162,73,22,66,198,33,243,69,163,73,221,41,175,149,60,42,125,213,46,250,181,81,208,163,103,164,197,232,229,196,117,210,34,168,172,69,2,246,55,93,236,103,252,204,104,64,187,82,68,173,106,210,110,22,118,202,75,133,1,96,234,28,111,198,118,202,248,222,25,80,89,126,181,9,56,230,148,233,110,182,53,103,54,233,173,198,105,235,142,244,135,214,38,173,185,164,226,124,222,163,122,84,35,118,99,116,145,248,14,247,58,251,58,11,247,24,93,39,206,138,158,32,156,55,35,218,156,185,2,85,117,36,255,44,212,207,58,97,150,192,0,67,47,23,205,248,14,136,242,93,130,17,235,80,26,212,177,196,38,232,62,220,221,231,25,74,53,105,27,117,159,214,170,159,182,54,233,229,207,236,247,91,35,137,91,146,255,0,92,215,23,235,141,205,16,62,230,23,137,107,165,46,101,3,32,130,170,18,123,21,252,187,64,134,11,43,180,75,71,151,8,75,5,228,188,115,220,47,228,157,146,95,237,141,189,206,190,197,62,4,121,58,150,232,49,230,184,188,171,56,110,111,50,60,234,72,194,163,250,212,161,82,166,219,69,159,54,146,240,105,59,228,25,2,42,204,64,156,207,223,155,9,234,3,177,62,101,48,166,40,235,196,124,2,238,213,140,91,159,30,69,214,158,21,69,15,58,75,192,88,125,105,159,79,141,38,22,139,29,242,104,194,175,246,155,188,171,202,115,229,202,249,84,147,142,120,70,18,33,163,156,25,123,115,208,55,168,173,198,104,98,17,112,192,93,66,191,69,95,79,64,173,161,203,91,11,149,116,145,199,170,90,39,205,4,165,202,1,231,157,224,102,9,55,9,157,50,58,64,187,56,23,156,208,72,252,17,125,200,85,46,192,72,4,245,38,205,11,120,10,83,52,111,220,30,59,235,81,253,218,38,189,47,118,171,58,18,79,148,178,112,184,24,128,204,244,169,119,9,15,137,31,243,111,113,159,240,200,17,207,74,136,39,199,47,133,74,243,170,212,167,157,79,53,36,189,201,67,166,219,231,118,155,51,13,192,198,62,213,167,217,197,201,73,210,16,100,204,72,194,171,6,117,156,219,204,157,152,49,221,155,129,172,212,60,73,204,165,94,229,70,1,25,190,83,86,192,185,142,240,27,64,131,46,242,115,135,135,11,87,138,45,217,38,77,137,53,1,203,39,92,254,59,52,122,76,63,232,159,87,173,172,218,45,89,196,51,16,31,141,143,1,170,104,233,158,190,186,18,208,71,206,250,245,78,101,49,240,65,95,204,163,38,242,67,246,104,194,140,191,31,255,125,140,129,170,234,148,123,140,241,212,188,244,11,208,67,48,202,11,186,187,202,131,245,0,104,192,33,195,157,85,60,199,123,51,94,117,244,236,64,252,92,124,36,113,57,85,142,206,158,156,23,222,233,135,28,92,71,84,105,15,233,104,236,226,184,61,24,55,227,80,85,210,90,233,19,254,34,223,133,76,29,71,110,219,227,242,39,70,230,164,125,90,64,247,170,221,102,229,235,173,6,86,201,40,48,220,84,167,2,204,174,83,158,64,47,222,51,241,51,123,114,152,133,157,224,254,22,137,159,240,31,243,51,132,14,185,67,14,234,61,166,219,127,99,85,171,225,7,60,163,103,43,21,60,154,247,170,126,21,221,65,115,69,53,159,178,252,144,153,136,50,168,181,26,147,72,135,82,200,237,15,73,119,137,3,241,190,216,34,241,25,249,132,50,150,104,53,198,93,117,213,200,202,152,109,65,96,172,175,42,158,227,184,13,120,160,234,61,106,101,79,185,39,231,3,60,200,237,183,36,167,242,135,31,248,62,160,119,130,43,64,28,3,241,150,236,237,233,86,35,100,184,173,60,227,118,147,22,50,188,90,161,226,57,218,69,204,64,196,227,212,142,57,233,6,194,236,30,213,74,77,222,43,143,209,132,120,29,84,150,136,207,72,59,164,161,9,173,250,246,17,76,93,118,177,213,196,232,120,212,202,222,177,37,235,5,167,128,247,237,124,190,173,70,131,6,25,167,221,94,193,133,115,210,126,13,241,112,230,35,218,38,173,65,117,183,19,157,92,45,89,80,82,224,182,144,81,249,250,41,203,7,207,187,1,170,190,242,117,62,15,247,13,239,199,76,155,250,122,191,133,120,80,123,227,214,135,46,159,153,154,186,78,165,240,46,60,234,156,138,154,71,255,143,175,55,168,205,14,101,31,74,33,119,248,117,203,145,133,205,25,212,40,84,95,191,86,246,69,238,175,100,33,104,4,106,60,109,244,11,136,199,171,86,190,142,78,7,227,227,211,156,89,136,85,229,7,247,58,154,8,153,245,139,78,115,166,9,106,167,65,117,62,81,212,22,232,228,206,58,95,199,142,213,175,53,86,101,231,149,43,65,212,42,192,63,254,209,183,121,191,215,94,95,93,57,100,33,23,120,213,61,21,79,20,185,10,171,7,103,132,149,63,209,99,5,200,251,111,119,116,51,200,249,128,6,176,214,243,111,123,140,230,55,25,128,7,234,193,174,86,30,192,19,210,43,223,159,40,248,52,154,109,127,118,220,245,80,138,68,71,115,187,47,168,92,95,124,20,212,209,249,23,42,206,63,219,69,63,100,96,147,54,150,112,246,148,95,124,228,213,240,190,157,89,152,44,248,201,235,30,213,109,237,156,186,80,121,2,196,23,252,103,133,230,181,100,61,132,169,189,170,115,190,20,130,26,193,232,236,113,100,225,125,224,91,27,1,79,117,85,185,185,80,121,240,169,58,93,104,143,137,220,230,133,30,185,242,117,172,17,100,183,128,35,11,9,123,144,232,56,185,221,221,5,190,18,92,65,163,182,165,210,133,22,144,193,176,91,115,70,129,212,8,60,1,39,23,68,243,13,26,141,91,125,185,0,25,214,163,58,239,130,250,22,95,85,20,176,35,39,120,116,167,35,59,15,236,129,60,225,84,88,119,215,156,116,208,240,104,232,41,43,95,39,61,15,116,61,183,15,87,190,222,156,241,17,238,136,57,184,96,184,136,222,15,127,166,126,42,138,171,219,196,108,243,168,149,119,177,55,215,4,106,137,51,43,103,20,186,129,59,192,113,59,178,19,207,97,141,157,109,212,170,253,159,187,107,111,14,159,117,163,250,188,227,46,206,167,130,122,99,13,142,136,230,145,7,2,250,70,221,89,35,135,204,177,179,190,42,183,237,246,130,218,38,92,80,121,23,180,231,65,60,206,89,243,184,237,39,211,211,130,163,215,76,22,160,23,194,75,77,214,145,11,236,34,42,73,35,92,149,89,181,37,235,83,49,7,3,122,101,71,138,92,64,20,83,119,234,229,220,116,3,169,157,158,186,57,106,92,91,178,1,3,209,56,179,170,31,122,158,70,192,227,236,248,91,178,20,189,243,253,116,242,128,120,156,220,238,238,26,74,133,12,172,122,135,242,228,155,116,31,201,54,103,111,9,56,181,91,224,59,247,58,244,146,186,208,38,253,121,195,221,207,139,85,174,104,190,219,196,90,112,214,54,214,8,102,27,235,136,2,184,80,29,209,87,115,193,249,20,226,241,215,153,11,230,102,48,58,62,135,23,38,51,105,64,115,139,234,140,2,78,231,48,219,156,74,101,23,155,240,169,192,159,228,246,204,163,114,245,91,200,201,141,142,14,179,37,139,207,186,177,170,83,165,46,20,223,239,172,145,230,12,250,130,198,58,118,215,184,246,230,122,76,244,90,78,229,193,26,129,108,171,138,2,214,72,163,182,188,234,253,232,91,189,228,9,56,21,214,221,245,197,71,224,12,224,62,42,123,27,156,96,55,66,174,85,119,48,232,66,61,234,242,26,46,20,170,13,227,169,15,127,203,119,124,173,101,23,79,89,180,75,168,204,249,219,211,168,163,141,170,211,181,160,242,52,18,110,115,214,200,23,182,159,100,97,125,59,210,45,89,204,54,79,149,171,4,111,74,240,56,185,160,57,227,39,220,86,237,66,91,75,85,85,207,142,148,42,143,167,42,231,177,70,168,71,118,118,164,221,38,229,8,167,255,105,201,6,8,78,39,183,187,187,168,242,52,66,109,15,87,41,79,45,166,226,243,52,6,206,247,211,105,40,126,199,25,79,119,215,156,52,229,222,113,199,228,157,242,119,53,35,23,108,138,167,218,133,6,160,67,242,84,41,178,187,203,46,246,16,229,217,168,87,250,153,178,142,108,116,116,164,116,215,183,177,134,94,206,77,83,255,83,223,142,116,111,158,42,79,245,252,195,123,21,23,74,189,166,243,253,215,11,23,204,73,99,117,251,180,202,41,12,234,8,233,176,171,162,128,53,130,175,59,245,146,176,71,205,153,175,155,11,148,39,21,32,190,160,122,22,10,92,93,197,200,160,176,36,219,156,179,83,116,161,52,58,110,159,96,169,92,123,114,221,22,78,155,172,42,23,74,240,84,69,1,93,168,175,134,94,210,57,79,253,93,232,23,31,181,154,62,232,255,43,57,12,119,225,188,53,123,1,202,132,213,251,34,205,25,202,29,245,117,161,137,194,169,84,208,216,168,179,102,101,231,117,202,242,146,14,219,201,5,180,83,171,53,193,197,147,23,181,184,221,221,213,156,97,173,128,17,48,42,93,37,157,163,215,98,170,243,37,229,169,229,66,125,53,21,214,221,117,222,14,153,136,199,121,254,195,67,148,199,233,90,108,122,222,8,178,170,150,11,245,213,192,233,238,226,243,167,192,183,5,140,126,71,109,7,200,204,170,218,181,96,141,120,107,186,208,23,200,252,163,26,167,187,107,78,166,27,162,227,211,43,57,140,158,165,132,8,85,113,1,118,72,158,26,53,82,86,216,250,114,129,93,236,79,133,192,25,212,82,158,145,196,200,89,167,107,137,230,41,83,7,116,231,212,166,199,242,18,206,171,111,71,218,146,237,182,112,23,219,121,254,35,168,143,157,29,61,235,81,157,81,64,183,237,173,154,157,146,61,124,157,114,117,125,255,143,120,227,118,43,68,39,160,239,173,224,176,45,89,60,11,230,169,209,145,134,74,51,66,231,20,110,110,154,114,129,211,109,187,187,64,121,172,144,137,202,83,249,122,15,85,30,109,142,131,11,176,70,112,34,93,107,22,74,163,83,95,23,218,156,233,7,229,217,168,87,207,63,16,207,213,93,168,115,239,144,206,121,170,247,127,220,93,195,164,195,6,229,113,48,236,237,195,100,58,85,117,142,2,58,53,157,50,114,237,89,168,175,206,29,233,222,60,68,7,92,91,165,242,12,95,193,61,181,91,212,234,57,58,117,161,78,215,10,56,139,126,29,187,190,186,115,193,71,184,175,182,81,111,113,236,194,209,142,20,92,139,227,253,33,131,158,48,168,118,161,116,118,120,185,174,92,96,23,135,82,120,198,128,53,43,221,214,80,10,106,167,6,83,225,252,195,91,211,133,130,55,175,169,176,238,174,61,57,90,61,149,57,255,231,34,117,51,213,51,66,43,69,25,217,89,35,124,169,135,173,158,249,186,187,198,109,240,109,102,200,113,154,27,115,167,81,171,158,41,218,165,249,71,181,59,59,159,2,252,90,245,201,3,119,87,34,127,202,130,234,49,135,28,89,21,50,189,53,231,2,232,66,17,79,181,11,5,46,168,57,97,112,119,129,242,128,11,125,222,172,244,5,124,222,87,202,29,103,7,67,167,37,213,53,2,78,2,162,227,169,187,11,29,74,117,91,33,163,223,114,186,80,15,153,237,58,185,128,186,80,143,22,168,238,72,201,78,74,189,247,69,176,231,105,133,218,169,244,51,118,113,35,233,121,170,119,170,1,167,138,85,229,60,95,152,32,61,172,167,106,46,228,246,154,147,62,15,120,186,173,168,195,133,210,158,167,186,35,13,26,222,154,179,208,242,121,158,250,114,1,78,219,186,1,141,115,206,209,111,121,136,242,56,25,185,37,75,245,178,122,22,26,186,46,58,82,252,180,71,183,105,165,42,107,27,25,25,179,170,218,181,244,91,148,145,157,251,34,120,182,159,204,124,235,202,5,229,123,129,10,174,184,111,232,5,200,233,28,39,131,227,44,20,241,132,204,170,125,145,148,175,38,183,95,31,11,247,124,107,157,90,185,55,67,231,57,206,26,41,207,121,2,117,230,130,218,43,129,189,0,220,95,232,170,157,154,179,70,154,9,206,128,94,223,73,245,213,86,115,166,219,196,221,224,106,119,70,103,135,213,157,26,221,9,175,142,231,245,177,182,100,209,255,132,12,231,30,233,80,202,67,118,167,156,53,82,198,249,219,186,238,145,94,107,241,249,33,219,201,224,132,243,0,207,115,85,53,50,110,211,137,124,125,59,210,111,186,182,0,231,225,121,35,167,255,177,139,173,134,159,84,207,245,200,5,87,95,49,11,189,105,245,167,194,154,75,156,87,223,243,18,223,116,33,231,97,12,170,189,115,143,73,191,83,223,83,187,223,116,217,69,43,245,188,209,109,56,185,32,154,167,209,169,239,121,137,255,221,178,139,91,50,85,92,240,17,249,60,79,21,183,127,55,151,93,236,49,131,100,239,184,190,46,244,111,181,246,228,112,175,213,231,250,167,252,191,173,213,156,193,137,247,70,199,4,255,187,188,248,124,193,118,186,240,255,95,127,171,245,63,152,159,57,69
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/statistics.cpp	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,132 @@
+#include "statistics.h"
+
+/**************************************************************************************************************************
+************************** Main function called every second **************************************************************
+**************************************************************************************************************************/
+uint64_t Statistics::UpdateStatistics(float humidity, float temperature, uint64_t seconds, uint64_t changeSecondsOffset)
+{
+    short int secondsIn5min = (seconds % 300); // 0..299
+    if (secondsIn5min == 0) {
+        changeSecondsOffset = Update24hrsData(changeSecondsOffset);
+    }
+    CalculateHumididty(humidity, secondsIn5min);
+    CalculateTemperature(temperature, secondsIn5min);
+    
+    // changeSecondsOffset is nessesary for changing time-grid if more then 24 hours left since devise was turned on
+    return changeSecondsOffset;
+}
+
+/**************************************************************************************************************************
+************************** Update average, minimum and maximum humidity in current five-minute interval ****************
+**************************************************************************************************************************/
+void Statistics::CalculateHumididty(float humidity, short int secondsIn5min)
+{
+    humidity5min[secondsIn5min] = humidity;
+    humidity5minSum += humidity5min[secondsIn5min];
+    humidity5minAverage = humidity5minSum / (secondsIn5min + 1);
+
+    if (humidity5min[secondsIn5min] > humidity5minMax || humidity5minMax == INIT_STATISTICS_NUMBER) {
+        humidity5minMax = humidity5min[secondsIn5min];
+    }
+    if (humidity5min[secondsIn5min] < humidity5minMin || humidity5minMin == INIT_STATISTICS_NUMBER) {
+        humidity5minMin = humidity5min[secondsIn5min];
+    }
+}
+
+/**************************************************************************************************************************
+************************** Update average, minimum and maximum temperature in current five-minute interval ****************
+**************************************************************************************************************************/
+void Statistics::CalculateTemperature(float temperature, short int secondsIn5min)
+{
+    // we use TEMPERATURE_MULTIPLIER = 10 for store temperatures tenths in integer values
+    temperature5min[secondsIn5min] = temperature * TEMPERATURE_MULTIPLIER;
+    temperature5minSum += temperature5min[secondsIn5min];
+    temperature5minAverage = temperature5minSum / (secondsIn5min + 1);
+
+    if (temperature5min[secondsIn5min] > temperature5minMax || temperature5minMax == INIT_STATISTICS_NUMBER) {
+        temperature5minMax = temperature5min[secondsIn5min];
+    }
+    if (temperature5min[secondsIn5min] < temperature5minMin || temperature5minMin == INIT_STATISTICS_NUMBER) {
+        temperature5minMin = temperature5min[secondsIn5min];
+    }
+}
+
+/**************************************************************************************************************************
+************************** Update humidity24hrs[][] and temperature24hrs[][] after each five-minute interval **************
+**************************************************************************************************************************/
+uint64_t Statistics::Update24hrsData(uint64_t changeSecondsOffset)
+{
+    // after each five-minute interval we moving to next value if it's availiable 
+    // OR shifting the entire array and update just last value if 24 hrs are already gone 
+    if (Counter24hrs < 287) {
+        Counter24hrs ++;
+    } else {
+        for (int i = 0; i < 288; i++) {
+            humidity24hrs[0][i] = humidity24hrs[0][i + 1];
+            humidity24hrs[1][i] = humidity24hrs[1][i + 1];
+            humidity24hrs[2][i] = humidity24hrs[2][i + 1];
+            temperature24hrs[0][i] = temperature24hrs[0][i + 1];
+            temperature24hrs[1][i] = temperature24hrs[1][i + 1];
+            temperature24hrs[2][i] = temperature24hrs[2][i + 1];
+        }
+        Counter24hrs = 287;
+        changeSecondsOffset += 300;
+    }
+    
+    // update the current value 
+    humidity24hrs[0][Counter24hrs] = humidity5minAverage;
+    humidity24hrs[1][Counter24hrs] = humidity5minMin;
+    humidity24hrs[2][Counter24hrs] = humidity5minMax;
+    temperature24hrs[0][Counter24hrs] = temperature5minAverage;
+    temperature24hrs[1][Counter24hrs] = temperature5minMin;
+    temperature24hrs[2][Counter24hrs] = temperature5minMax;
+
+    // initialize all values using for calculations "inside" five-minute interval
+    for (int i = 0; i < 300; i++) {
+        humidity5min[i] = INIT_STATISTICS_NUMBER;
+        temperature5min[i] = INIT_STATISTICS_NUMBER;
+    }
+    humidity5minSum = 0;
+    humidity5minMax = INIT_STATISTICS_NUMBER;
+    humidity5minMin = INIT_STATISTICS_NUMBER;
+    temperature5minSum = 0;
+    temperature5minMax = INIT_STATISTICS_NUMBER;
+    temperature5minMin = INIT_STATISTICS_NUMBER;
+    
+    // changeSecondsOffset is nessesary for changing time-grid if more then 24 hours left since devise was turned on
+    return changeSecondsOffset;
+}
+
+/**************************************************************************************************************************
+************************** Initialization for all statistics values and arrays ********************************************
+**************************************************************************************************************************/
+void Statistics::InitValues(float humidity, float temperature)
+{
+    for (int i = 0; i < 300; i++) {
+        humidity5min[i] = INIT_STATISTICS_NUMBER;
+        temperature5min[i] = INIT_STATISTICS_NUMBER;
+    }
+    for (int i = 0; i < 288; i++) {
+        humidity24hrs[0][i] = INIT_STATISTICS_NUMBER;
+        humidity24hrs[1][i] = INIT_STATISTICS_NUMBER;
+        humidity24hrs[2][i] = INIT_STATISTICS_NUMBER;
+        temperature24hrs[0][i] = INIT_STATISTICS_NUMBER;
+        temperature24hrs[1][i] = INIT_STATISTICS_NUMBER;
+        temperature24hrs[2][i] = INIT_STATISTICS_NUMBER;
+    }
+    humidity5min[0] = humidity;
+    humidity5minMin = humidity;
+    humidity5minMax = humidity;
+    humidity24hrs[0][0] = humidity;
+    humidity24hrs[1][0] = humidity;
+    humidity24hrs[2][0] = humidity;
+
+    temperature5min[0] = temperature * TEMPERATURE_MULTIPLIER;
+    temperature5minMin = temperature * TEMPERATURE_MULTIPLIER;
+    temperature5minMax = temperature * TEMPERATURE_MULTIPLIER;
+    temperature24hrs[0][0] = temperature * TEMPERATURE_MULTIPLIER;
+    temperature24hrs[1][0] = temperature * TEMPERATURE_MULTIPLIER;
+    temperature24hrs[2][0] = temperature * TEMPERATURE_MULTIPLIER;
+
+    Counter24hrs = 0;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/statistics.h	Fri Oct 07 11:08:19 2016 +0000
@@ -0,0 +1,47 @@
+#include "mbed.h"
+
+#ifndef STATISTICS_H_
+#define STATISTICS_H_
+
+#define  INIT_STATISTICS_NUMBER  32767
+#define  DELTA_HUMIDITY  6
+#define  DELTA_TEMPERATURE  1
+#define  TEMPERATURE_MULTIPLIER  10
+
+/**************************************************************************************************************************
+************************** User class for calculate statistics for last 24 hrs ********************************************
+**************************************************************************************************************************/
+
+class Statistics
+{
+public:
+    // xxxx24hrs[][] arrays contains all 24-hrs statistics data:
+    // 1. xxxx24hrs[0][0...287] - Average values calculated for each five-minute interval
+    // 2. xxxx24hrs[1][0...287] - Minimums calculated for each five-minute interval
+    // 2. xxxx24hrs[2][0...287] - Maximums calculated for each five-minute interval
+    // p.s. there are 288 five-minute intervals in 24 hours
+
+    short int humidity24hrs[3][288];
+    short int temperature24hrs[3][288];
+
+    uint64_t UpdateStatistics(float humidity, float temperature, uint64_t seconds, uint64_t changeSecondsOffset);
+    void InitValues(float humidity, float temperature);
+    
+private:
+    
+    // functions called every second to update average value, minimum and maximum in current five-minute interval
+    void CalculateTemperature(float temperature, short int secondsIn5min);
+    void CalculateHumididty(float humidity, short int secondsIn5min);
+    // function called every 5 minutes to add new value to xxxx24hrs[][] arrays
+    uint64_t Update24hrsData(uint64_t changeSecondsOffset);
+    
+    // counter of five-minute intervals (0...287)
+    short int Counter24hrs;
+    // values for calculations "inside" five-minute interval
+    short int humidity5min[300], temperature5min[300];
+    int humidity5minAverage, temperature5minAverage;
+    int humidity5minSum, temperature5minSum;
+    short int humidity5minMax, humidity5minMin, temperature5minMax, temperature5minMin;
+};
+
+#endif /* STATISTICS_H_ */
\ No newline at end of file