// ILI9341 example with embedded color bitmaps in sketch.
// WILL NOT FIT ON ARDUINO UNO OR OTHER AVR BOARDS;
// uses large bitmap image stored in array!
// Options for converting images to the format used here include:
// http://www.rinkydinkelectronics.com/t_imageconverter565.php
// or
// GIMP (https://www.gimp.org/) as follows:
// 1. File -> Export As
// 2. In Export Image dialog, use 'C source code (*.c)' as filetype.
// 3. Press export to get the export options dialog.
// 4. Type the desired variable name into the 'prefixed name' box.
// 5. Uncheck 'GLIB types (guint8*)'
// 6. Check 'Save as RGB565 (16-bit)'
// 7. Press export to save your image.
// Assuming 'image_name' was typed in the 'prefixed name' box of step 4,
// you can have to include the c file, then using the image can be done with:
// tft.drawRGBBitmap(0, 0, image_name.pixel_data, image_name.width, image_name.height);
// See also https://forum.pjrc.com/threads/35575-Export-for-ILI9341_t3-with-GIMP
#include "SPI.h"
#include <Adafruit_ILI9341.h>
#include <DHT.h>
#include "image.h"
#define DHTPIN 14
DHT dht(DHTPIN, DHT22);
#define TFT_DC 2
#define TFT_CS 15
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
float humidity, humidity2, temperature, temperature2;
void setup() {
Serial.begin(115200);
dht.begin();
tft.begin();
tft.setTextColor(ILI9341_BLACK);
tft.fillScreen(ILI9341_WHITE);
tft.setCursor(10, 100);
tft.setTextSize(3);
tft.println("MESE");
tft.setCursor(10, 150);
tft.setTextSize(2);
tft.println("mesebilisim.com");
tft.drawRGBBitmap(
0,
0,
(uint16_t *)battery,
48, 48);
tft.drawRGBBitmap(
160,
0,
(uint16_t *)wifi,
48, 48);
} // setup
void loop(void) {
// tft.fillScreen(ILI9341_WHITE);
// tft.drawRGBBitmap(
// 20,
// 20,
// (uint16_t *)image1,
// image_w, image_h);
// delay(3000);
// tft.fillScreen(ILI9341_WHITE);
// tft.drawRGBBitmap(
// 20,
// 20,
// (uint16_t *)image2,
// image_w, image_h);
// delay(3000);
// humidity2 = dht.readHumidity();
// temperature2 = dht.readTemperature();
// if (temperature != temperature2)
// {
// tft.fillRect(100, 120, 120, 50, ILI9341_WHITE);
// tft.setCursor(10, 120);
// tft.setTextColor(ILI9341_RED);
// tft.setTextSize(3);
// tft.println("TEMP:");
// tft.setCursor(100, 120);
// tft.println(temperature2);
// tft.setCursor(200, 120);
// tft.println("C");
// }
// if (humidity != humidity2)
// {
// tft.fillRect(100, 170, 120, 50, ILI9341_WHITE);
// tft.setCursor(10, 170);
// tft.setTextColor(ILI9341_RED);
// tft.setTextSize(3);
// tft.println("HUMI:");
// tft.setCursor(100, 170);
// tft.println(humidity2);
// tft.setCursor(200, 170);
// tft.println("%");
// }
// temperature = temperature2;
// humidity = humidity2;
delay(3000);
} // loop