[SIMPLE PROGRAM] HYT humidity & temp sensor polling / showing received data at TFT with capacitive touchscreen
Dependencies: FT800_2 HYT mbed
HYT humidity and temperature sensor polling & showing received data at TFT via graphical controller FT800/FT801.
Hardware
- HYT-271 / HYT-221 / HYT-939 humidity and temperature sensor by IST-AG
- TFT module uxTouch by Riverdi
- Break Out Board 20 by Riverdi
- Any mbed platform with I2C interface, SPI interface and 2 free GPIO for PD and INT signals
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.
You have to connect VDD to BLVDD at Break Out Board if you use the board:
MCU-board to HYT sensor
MCU-board is connected to sensor via I2C. Remember to use pull-up resisrors there:
Подробнее в статьях Как перестать бояться и полюбить mbed [Часть 1 - 5] на https://habrahabr.ru/users/uuuulala/topics/
Diff: TFT/display.Draw_Grids.cpp
- Revision:
- 0:1f5444f2977d
diff -r 000000000000 -r 1f5444f2977d TFT/display.Draw_Grids.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TFT/display.Draw_Grids.cpp Mon Sep 26 15:39:09 2016 +0000 @@ -0,0 +1,41 @@ +#include "display.h" + +/************************************************************************************************************************** +************************** Draw horisontal grid for temperature (-50 .. +125) ********************************************* +**************************************************************************************************************************/ +void Display::HorisontalGrid_CurrentTemp() +{ + (*_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 humidity (0 .. 100) *************************************************** +**************************************************************************************************************************/ +void Display::HorisontalGrid_CurrentHumidity() +{ + (*_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; + } +} \ No newline at end of file