/*
Simple "Hello World" for ILI9341 LCD
https://wokwi.com/arduino/projects/308024602434470466
*/
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#define TFT_DC 2
#define TFT_CS 15
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
#define NTCpin 12
const float BETA = 3950; // should match the Beta Coefficient of the thermistor
void setup() {
tft.begin();
Serial.begin(9600);
tft.setCursor(26, 120);
tft.setTextColor(ILI9341_RED);
tft.setTextSize(3);
tft.println("Hello, world TFT!");
Serial.println("Hello, world TFT!");
tft.setCursor(20, 160);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(2);
tft.println("I can has colors?");
delay(2000);
// Meme reference: https://english.stackexchange.com/questions/20356/origin-of-i-can-haz
pinMode(12,INPUT);
analogReadResolution(10);
}
void loop() {
float sensorValue = analogRead(12);
float celsius = 1 / (log(1 / (1023 / sensorValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
tft.fillScreen(ILI9341_BLACK);
tft.setCursor(20, 160);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(3);
tft.println(celsius );
Serial.println(celsius);
delay(1000);
}