/*******************************************************************
This sletch displays all the (known to me at this time)
Colors for the Color 320x240 TFT Display, ILI9341 Controller Chip.
Screen URL Link: https://www.pjrc.com/store/display_ili9341.html
Developed using a Teensy 3.2 Board
Written by Ralph Freshour
Version 1.0 11/19/2015
Index Color Name
1 ILI9341_BLACK
2 ILI9341_NAVY
3 ILI9341_DARKGREEN
4 ILI9341_DARKCYAN
5 ILI9341_MAROON
6 ILI9341_PURPLE
7 ILI9341_OLIVE
8 ILI9341_LIGHTGREY
9 ILI9341_DARKGREY
10 ILI9341_BLUE
11 ILI9341_GREEN
12 ILI9341_CYAN
13 ILI9341_RED
14 ILI9341_MAGENTA
15 ILI9341_YELLOW
16 ILI9341_WHITE
17 ILI9341_ORANGE
18 ILI9341_GREENYELLOW
19 ILI9341_PINK
*******************************************************************/
#include "SPI.h"
#include "ILI9341_t3.h"
// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10
// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);
int intButtonRadius = 5;
void setup()
{
tft.begin();
tft.setRotation(3); // normal landscape orientation
tft.fillScreen(ILI9341_WHITE);
//Serial.begin(9600);
// Note: Serial Window prints are working but not really needed so I have remmed them out
//while (!Serial) ; // wait for Arduino Serial Monitor
//Serial.println("Color LCD Samples Started!");
paint_Color_Samples();
//Serial.println("Done!");
}
void loop(void)
{
// nothing to do here really
}
/**************************************************************************
This function paints 19 color samples with an index number because there is
not enough room to paint the color name in most cases.
***************************************************************************/
void paint_Color_Samples()
{
int int1Left = 15;
int int1Top = 5;
int int2Top = 65;
int int3Top = 125;
int int4Top = 185;
int int1Width = 50;
int int1Height = 50;
int int1TextLeft = 0;
int int1TextTop = int1Top + 10;
int int2TextTop = int2Top + 10;
int int3TextTop = int3Top + 10;
int int4TextTop = int4Top + 10;
tft.setRotation(3); // normal landscape orientation
tft.fillScreen(ILI9341_WHITE);
tft.setTextSize(2);
// Row 1
tft.fillRoundRect(int1Left, int1Top, int1Width, int1Height, 0, ILI9341_BLACK);
tft.setCursor(int1TextLeft+34, int1TextTop+8);
tft.setTextColor(ILI9341_WHITE);
tft.println("1");
tft.fillRoundRect(int1Left + 60, int1Top, int1Width, int1Height, 0, ILI9341_NAVY);
tft.setCursor(int1TextLeft+94, int1TextTop+8);
tft.setTextColor(ILI9341_WHITE);
tft.println("2");
tft.fillRoundRect(int1Left + 120, int1Top, int1Width, int1Height, 0, ILI9341_DARKGREEN);
tft.setCursor(int1TextLeft+154, int1TextTop+8);
tft.setTextColor(ILI9341_WHITE);
tft.println("3");
tft.fillRoundRect(int1Left + 180, int1Top, int1Width, int1Height, 0, ILI9341_DARKCYAN);
tft.setCursor(int1TextLeft+214, int1TextTop+8);
tft.setTextColor(ILI9341_WHITE);
tft.println("4");
tft.fillRoundRect(int1Left + 240, int1Top, int1Width, int1Height, 0, ILI9341_MAROON);
tft.setCursor(int1TextLeft+274, int1TextTop+8);
tft.setTextColor(ILI9341_WHITE);
tft.println("5");
// Row 2
tft.fillRoundRect(int1Left, int2Top, int1Width, int1Height, 0, ILI9341_PURPLE);
tft.setCursor(int1TextLeft+34, int2TextTop+8);
tft.setTextColor(ILI9341_WHITE);
tft.println("6");
tft.fillRoundRect(int1Left + 60, int2Top, int1Width, int1Height, 0, ILI9341_OLIVE);
tft.setCursor(int1TextLeft+94, int2TextTop+8);
tft.setTextColor(ILI9341_WHITE);
tft.println("7");
tft.fillRoundRect(int1Left + 120, int2Top, int1Width, int1Height, 0, ILI9341_LIGHTGREY);
tft.setCursor(int1TextLeft+154, int2TextTop+8);
tft.setTextColor(ILI9341_BLACK);
tft.println("8");
tft.fillRoundRect(int1Left + 180, int2Top, int1Width, int1Height, 0, ILI9341_DARKGREY);
tft.setCursor(int1TextLeft+214, int2TextTop+8);
tft.setTextColor(ILI9341_WHITE);
tft.println("9");
tft.fillRoundRect(int1Left + 240, int2Top, int1Width, int1Height, 0, ILI9341_BLUE);
tft.setCursor(int1TextLeft+268, int2TextTop+8);
tft.setTextColor(ILI9341_WHITE);
tft.println("10");
// Row 3
tft.fillRoundRect(int1Left, int3Top, int1Width, int1Height, 0, ILI9341_GREEN);
tft.setCursor(int1TextLeft+28, int3TextTop+8);
tft.setTextColor(ILI9341_BLACK);
tft.println("11");
tft.fillRoundRect(int1Left + 60, int3Top, int1Width, int1Height, 0, ILI9341_CYAN);
tft.setCursor(int1TextLeft+88, int3TextTop+8);
tft.setTextColor(ILI9341_BLACK);
tft.println("12");
tft.fillRoundRect(int1Left + 120, int3Top, int1Width, int1Height, 0, ILI9341_RED);
tft.setCursor(int1TextLeft+148, int3TextTop+8);
tft.setTextColor(ILI9341_WHITE);
tft.println("13");
tft.fillRoundRect(int1Left + 180, int3Top, int1Width, int1Height, 0, ILI9341_MAGENTA);
tft.setCursor(int1TextLeft+208, int3TextTop+8);
tft.setTextColor(ILI9341_BLACK);
tft.println("14");
tft.fillRoundRect(int1Left + 240, int3Top, int1Width, int1Height, 0, ILI9341_YELLOW);
tft.setCursor(int1TextLeft+268, int3TextTop+8);
tft.setTextColor(ILI9341_BLACK);
tft.println("15");
// Row 4
tft.fillRoundRect(int1Left, int4Top, int1Width, int1Height, 0, ILI9341_WHITE);
tft.setCursor(int1TextLeft+28, int4TextTop+8);
tft.setTextColor(ILI9341_BLACK);
tft.println("16");
tft.fillRoundRect(int1Left + 60, int4Top, int1Width, int1Height, 0, ILI9341_ORANGE);
tft.setCursor(int1TextLeft+88, int4TextTop+8);
tft.setTextColor(ILI9341_BLACK);
tft.println("17");
tft.fillRoundRect(int1Left + 120, int4Top, int1Width, int1Height, 0, ILI9341_GREENYELLOW);
tft.setCursor(int1TextLeft+148, int4TextTop+8);
tft.setTextColor(ILI9341_BLACK);
tft.println("18");
tft.fillRoundRect(int1Left + 180, int4Top, int1Width, int1Height, 0, ILI9341_PINK);
tft.setCursor(int1TextLeft+208, int4TextTop+8);
tft.setTextColor(ILI9341_BLACK);
tft.println("19");
}