There were a LOT of syntax errors, bad practice, ...
Here is some example code:
#include <MCUFRIEND_kbv.h> //Librería Necesaria
MCUFRIEND_kbv tft;
#include <FreeDefaultFonts.h> //SmallFont, BigFont, SevenSegFont
#include <Fonts/FreeSerif12pt7b.h> //Free Font that comes with GFX
#define NEGRO 0x0000
#define AZUL 0x001F
#define ROJO 0xF800
#define VERDE 0x07E0
#define CIAN 0x07FF
#define MAGENTA 0xF81F
#define AMARILLO 0xFFE0
#define BLANCO 0xFFFF
int color;
int led = 10; //Pin PWM donde va conectado el LED
//Define el ancho y largo de la pantalla en pixeles
int x_size = 480; int y_size = 320;
bool settscrsize (int w, int h)
{
if ((w <= 0) || (h <= 0)) return false;
x_size = w; y_size = h;
return true;
}
void LogoSielco(int x1, int y1)
{
// these are all Adafruit_GFX class methods
tft.setFont(&FreeBigFont); //note that you use &
// tft.setFont(&FreeSerif12pt7b); //better looking font
tft.fillTriangle(x1, y1, x1 + 19, y1, x1, y1 + 19, ROJO);
tft.fillTriangle(x1 + 18, y1 + 1, x1 + 23, y1 - 5, x1 + 12, y1 + 1, ROJO);
tft.fillTriangle(x1 + 2, y1 + 18, x1 + 4, y1 + 18, x1 + 2, y1 + 14, ROJO);
tft.fillTriangle(x1 + 3, y1 + 14, x1 + 8, y1 + 14, x1 + 5, y1 + 19, ROJO);
tft.fillTriangle(x1 + 23, y1 + 6, x1 + 23, y1 + 26, x1 + 3, y1 + 26, NEGRO);
tft.fillTriangle(x1 + 2, y1 + 27, x1 - 1, y1 + 31, x1 + 7, y1 + 27, NEGRO);
tft.fillTriangle(x1 + 21, y1 + 7, x1 + 18, y1 + 7, x1 + 20, y1 + 10, NEGRO);
tft.fillTriangle(x1 + 18, y1 + 5, x1 + 13, y1 + 12, x1 + 19, y1 + 12, NEGRO);
tft.setTextColor(NEGRO); //Free Fonts always transparent
tft.setCursor(x1 + 24, y1 + 5 + 10); //Free Fonts draw from baseline
// Print class methods from Print.h
tft.print("Sielco");
}
void setup(void)
{
// these are MCUFRIEND_kbv methods
uint16_t ID = tft.readID();
tft.begin(ID);
// these are all Adafruit_GFX class methods
tft.setRotation(1); //Landscape
tft.fillScreen(BLANCO);
}
void loop(void)
{
LogoSielco(180, 80);
}
From the extras/mcufriend_how_to.txt:
MCUFRIEND_kbv inherits all the methods from
the Adafruit_GFX class: Overview | Adafruit GFX Graphics Library | Adafruit Learning System
and Print class: Serial.print() - Arduino ReferenceThe only "new" methods are hardware related:
vertScroll(), readGRAM(), readPixel(), setAddrWindow(), pushColors(), readID(), begin()
readReg(), pushCommand(), WriteCmdData() access the controller registers
I suggest that you try the GFX tutorial.
Please ask questions. Quote which example or tutorial you are having difficulty with.
People are happy to help. (if they know where to look e.g. link or sketch name)
David.