Hey everyone I am looking for some input in my header file for my arduino touchscreen. I currently I have the code in my sketch and I am trying to improve efficiency by placing the homescreen initialization in a header file.
Here is my header
#ifdef Homescreen_h
#define Homescreen_h
#include "Arduino.h"
class Homescreen
{
public
homescreen(void);
buttons(void);
boxes(void);
text(void);
};
#endif
and here is my cpp.
#include <LGDP4535.h>
#include<Arduino.h>
#include<Homescreen.h>
#include<Adafruit_GFX.h>
//Define colors pallate available
//16bit
#define Black 0x0000
#define Navy 0x000F
#define DarkGreen 0x03E0
#define LightGrey 0xC618
#define White 0xFFFF
LGDP4535 tft;
Homescreen::Homescreen()
{
//HomeScreen
void Homescreen::boxes()
{
//Initialize screen boxes
tft.fillRoundRect(0, 0, 210, 25, 5, Blue);
tft.fillRoundRect(0, 30, 220, 40, 5, LightGrey);
tft.fillRoundRect(0, 75, 160, 25, 5, Blue);
tft.fillRoundRect(0, 105, 220, 40, 5, LightGrey);
tft.fillRoundRect(0, 150, 240, 42, 5, LightGrey);
}
void Homescreen::text()
{
//Screen Text
tft.setCursor(10,5);
tft.setTextSize (3);
tft.setTextColor (White);
tft.print("Temperature");
tft.setCursor(10,80);
tft.setTextSize (3);
tft.setTextColor (White);
tft.print("Humidity");
}
void Homescreen::buttons()
{
//Initialize buttons
tft.fillCircle(295, 25, 30, Navy);
tft.drawChar(283, 5, 49, White, Navy, 5);
tft.fillCircle(295, 83, 30, Navy);
tft.drawChar(283, 65, 50, White, Navy, 5);
tft.fillCircle(295, 138, 30, Navy);
tft.drawChar(283, 121, 51, White, Navy, 5);
// tft.fillCircle(295, 193, 30, Navy);
// tft.drawChar(283, 178, 52 ,White, Navy, 5);
//Page select
tft.drawChar(292, 200, 175 ,White, Navy, 5);
tft.drawChar(0, 200, 174 ,White, Navy, 5);
}
Its not quite working out for me. lol and input would be awesome!!