#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include <Fonts/FreeSerif12pt7b.h>
//#include <Fonts/FreeSerifBoldItalic9pt7b.h>
//#include <Fonts/FreeSerifBoldItalic12pt7b.h>
#include <Fonts/FreeSerifBoldItalic24pt7b.h>
#define TFT_DC 9
#define TFT_CS 10
#define slider A0
#define WHITE 0xFFFF
#define BLACK 0x0000
#define BLUE 0x2A6C
#define Lt_BLUE 0x043F
#define OFF_WHITE 0xDEDB
#define LT_BROWN 0xB328
#define DK_BROWN 0x6A05
#define TEAL 0x07F9
#define DK_RED 0x6145
float pi = 3.14159;
float last_reading = 0;
float reading_Change = -15;
bool Startup = true;
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
int x, y, w, h;
const char *CHAR_reading;
void setup() {
// Serial.begin(9600);
// Serial.println("ILI9341 Test!");
int Temp_y_pos = 65;
int Brewing_y_pos = 130;
int Brewing_sec_y_pos = 160;
int preinf_y_pos = 180;
int Last_shot_y_pos = 205;
tft.begin();
tft.fillScreen(OFF_WHITE);
tft.fillRect(0, 0, 240, 145, BLUE);
tft.drawCircle(120, 120, 120, BLACK);
tft.fillRoundRect(20, 105, 200, 60, 44, DK_BROWN);
tft.setTextSize(1); tft.setFont(&FreeSerif12pt7b); tft.setCursor(120 + 25, Temp_y_pos + 12);
Print_in_center("/180", Temp_y_pos + 30);
tft.setTextColor(OFF_WHITE); tft.setTextSize(1);
Print_in_center("Brewing...", Brewing_y_pos);
Print_in_center("32.51s", Brewing_sec_y_pos);
tft.setTextColor(BLACK); tft.setTextSize(1); tft.setFont(); tft.setCursor (30,preinf_y_pos);
tft.print("Pre-Infus:");
tft.setTextSize(1); tft.setFont(&FreeSerif12pt7b);
tft.print("20% | 5.5sec");
tft.setTextColor(BLACK); tft.setTextSize(1); tft.setFont(); tft.setCursor (60,Last_shot_y_pos);
tft.print("Last Shot:");
tft.setTextSize(1); tft.setFont(&FreeSerif12pt7b);
tft.print("35.6sec");
}
void loop(void) {
int Temp_y_pos = 65;
float reading_maxpoint = 1023;
float reading = ((analogRead(slider) / reading_maxpoint) * 195);
float TEMP_reading = ((analogRead(slider) / reading_maxpoint));
tft.fillRect(55, 34, 130, 38, BLUE);
String STR_reading = String(reading);
CHAR_reading =STR_reading.c_str();
tft.setTextColor(BLACK); tft.setTextSize(0); tft.setFont(&FreeSerifBoldItalic24pt7b);
Print_in_center(CHAR_reading,Temp_y_pos);
//////////////////////////////////////////////////////////////////////////
// float LG_circle_rad = 120;
// float SM_circle_rad = 110;
// float xcenter = 240 / 2;
// float ycenter = 240 / 2;
// if (reading - 1 > last_reading || Startup == true) {
// if (Startup == false){reading_Change = reading - last_reading;}
// last_reading = reading;
// for (float i = reading_Change; i < reading; i = i + 0.1) {
// float angle_rad = i * pi / 180;
// //Serial.print(i);
// int x1 = -cos(angle_rad) * LG_circle_rad + xcenter;
// int y1 = -sin(angle_rad) * LG_circle_rad + ycenter;
// int x2 = -cos(angle_rad) * SM_circle_rad + xcenter;
// int y2 = -sin(angle_rad) * SM_circle_rad + ycenter;
// int colortest = (i + 18) * 1.2;
// tft.drawLine(x1, y1, x2, y2, tft.color565(colortest, 0, -colortest));
// }
// }
// if (reading + 1 < last_reading || Startup == true) {
// last_reading = reading;
// for (float i = 195; i > reading; i = i - 0.1) {
// float angle_rad = i * pi / 180;
// //Serial.print(i);
// int x1 = -cos(angle_rad) * LG_circle_rad + xcenter;
// int y1 = -sin(angle_rad) * LG_circle_rad + ycenter;
// int x2 = -cos(angle_rad) * SM_circle_rad + xcenter;
// int y2 = -sin(angle_rad) * SM_circle_rad + ycenter;
// tft.drawLine(x1, y1, x2, y2, 0x0000);
// }
// }
// Startup = false;
// delay(100);
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
lcd1:VCC
lcd1:GND
lcd1:CS
lcd1:RST
lcd1:D/C
lcd1:MOSI
lcd1:SCK
lcd1:LED
lcd1:MISO
pot1:VCC
pot1:SIG
pot1:GND
r1:1
r1:2