#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include "Wire.h"
#define ILI9341_BLACK 0x0000 ///< 0, 0, 0
#define ILI9341_NAVY 0x000F ///< 0, 0, 123
#define ILI9341_DARKGREEN 0x03E0 ///< 0, 125, 0
#define ILI9341_DARKCYAN 0x03EF ///< 0, 125, 123
#define ILI9341_MAROON 0x7800 ///< 123, 0, 0
#define ILI9341_PURPLE 0x780F ///< 123, 0, 123
#define ILI9341_OLIVE 0x7BE0 ///< 123, 125, 0
#define ILI9341_LIGHTGREY 0xC618 ///< 198, 195, 198
#define ILI9341_DARKGREY 0x7BEF ///< 123, 125, 123
#define ILI9341_BLUE 0x001F ///< 0, 0, 255
#define ILI9341_GREEN 0x07E0 ///< 0, 255, 0
#define ILI9341_CYAN 0x07FF ///< 0, 255, 255
#define ILI9341_RED 0xF800 ///< 255, 0, 0
#define ILI9341_MAGENTA 0xF81F ///< 255, 0, 255
#define ILI9341_YELLOW 0xFFE0 ///< 255, 255, 0
#define ILI9341_WHITE 0xFFFF ///< 255, 255, 255
#define ILI9341_ORANGE 0xFD20 ///< 255, 165, 0
#define ILI9341_GREENYELLOW 0xAFE5 ///< 173, 255, 41
#define ILI9341_PINK 0xFC18 ///< 255, 130, 198
//#define TFT_DC 2
//#define TFT_CS 5
Adafruit_ILI9341 tft = Adafruit_ILI9341();
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode (LED_BUILTIN, OUTPUT);
Serial.begin (115200);
tft.begin();
tft.setRotation(0);
tft.setCursor(0, 0);
tft.setTextColor(ILI9341_BLUE);
tft.setTextSize(2);
tft.println("Hello World!");
xTaskCreatePinnedToCore (
loop2, // Function to implement the task
"loop2", // Name of the task
1000, // Stack size in bytes
NULL, // Task input parameter
0, // Priority of the task
NULL, // Task handle.
0 // Core where the task should run
);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite (LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay (300); // wait for a second
digitalWrite (LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay (300); // wait for a second
}
// the loop2 function also runs forver but as a parallel task
void loop2 (void* pvParameters) {
while (1) {
Serial.print ("Hello");
delay (500); // wait for half a second
Serial.println (" World");
delay (500); // wait for half a second
}
}