david_prentice:
@Campax2,
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:
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.
Your code if it worked for me !!
Thanks David, I really appreciate your help, I really do not know how to use Adafruit's new libraries, I'll have to start with that, I already had a project built with Rinky Dinky libraries, I had a hard time doing it, but there's no problem, Now that I changed the screen I will need to start it again, they are like 2,300 lines of code, but in advance thank you so much for helping me to understand more the libraries that I have not used, I would appreciate it if you helped me learn more about the creation of geometric figures, and the use of the touch sensor of the screen, to be able to create touch buttons in my project, Regards!