Please help. I have a TFT screen module and it didn't work. I searched it on internet but found nothing. All the information all i see on this module is "RoboClass RC-10008" and "KMRTM2018-SPI v1".
note: im using arduino uno and you can see the screen details in here: RC-10008 1.8'' SPI Serial TFT LCD Ekran - RoboClass (this website is not english, so you need to translate that.)
Sorry, but there are NO DETAILS at the link you provided. It is only sales information. You actually need to contact them and get the detail information on that device that shows the connections and a sample program to make it work.
Minimal infos.
Contrary infos (Turkish):
- 1.8" SPI Serial TFT LCD Display
- Scale: 1.8 inch SPI serial bus
- Resolution: 128*160
- Driver IC: ST7735
- Properties
-
- Support all kinds of singlechip flat plugs without any connection
-
- Integrated stabilized IC supports 5V or 3.3V power supply
-
- Plate load level conversion scheme, perfectly matched with 5V/3.3V IO level, Support for various MCU IO connections
-
- Integrated SD card extension circuit
Sorry but all information i was got is this and i don't know how to use TFT LCD screens. This is my first screen project. I watched videos, tested libraires but i can't code this module correctly.
And thanks for the link but idk how to code a TFT screen.
oh and im using arduino uno
But look at how much you have already learned! Now go buy a screen with documentation and example programs so you can learn about programming such screens.
I don't want to buy a new screen but i got a lot of information abt this module.
I found the documentation but it didn't work.
What didn't work? That doc is for an interface chip with a hundred options. What options is your screen set for?
i searched them, changed codes about the information and i tried that like 60 times but it didnt work.
#include "SPI.h"
#include "TFT_22_ILI9225.h"
#include "math.h"
#define TFT_RST A4
#define TFT_RS A3
#define TFT_CS A5 // SS
#define TFT_SDI A2 // MOSI
#define TFT_CLK A1 // SCK
#define TFT_LED 0 // 0 if wired to +5V directly
#define TFT_BRIGHTNESS 200 // Initial brightness of TFT backlight (optional)
#define ROTATE_ANGLE 10 // Angle in degrees to rotate the triangle
struct _point
{
int16_t x;
int16_t y;
};
// Use hardware SPI (faster - on Uno: 13-SCK, 12-MISO, 11-MOSI)
TFT_22_ILI9225 tft = TFT_22_ILI9225(TFT_RST, TFT_RS, TFT_CS, TFT_SDI, TFT_CLK, TFT_LED);
// Variables and constants
_point c1, c2, c3, cc;
// Setup
void setup() {
tft.begin();
// Define triangle start coordinates
c1.x = 30; c1.y = 30;
c2.x = 120; c2.y = 80;
c3.x = 80; c3.y = 130;
// Determine the rotation point, i.e. the center of the triangle
cc = getCoordCentroid(c1, c2, c3);
tft.clear();
}
// Loop
void loop() {
// Calculate the number of steps to rotate the triangle a full rotation
int16_t steps = (int16_t)(360 / ROTATE_ANGLE);
// Draw solid triangle
tft.fillTriangle(30, 190, 80, 150, 130, 210, COLOR_BLUE);
for (int8_t i = 0; i < steps; i++) {
// Draw triangle
tft.drawTriangle(c1.x, c1.y, c2.x, c2.y, c3.x, c3.y, COLOR_GREEN);
// Rotate triangle
rotateTriangle(c1, c2, c3, cc, ROTATE_ANGLE);
delay(50);
}
delay(5000);
tft.clear();
}
// Get centroid of triangle
_point getCoordCentroid( _point a, _point b, _point c ) {
_point o;
o.x = (int16_t)((a.x + b.x + c.x) / 3);
o.y = (int16_t)((a.y + b.y + c.y) / 3);
return o;
}
// Rotate triangle around point r
void rotateTriangle( _point &a, _point &b, _point &c, _point r, int16_t deg ) {
// Convert degrees to radians
float angle = (float)deg * 1000 / 57296;
// Rotate each individual point
a = rotatePoint( r, angle, a);
b = rotatePoint( r, angle, b);
c = rotatePoint( r, angle, c);
}
// Rotate each point p around c
_point rotatePoint( _point c, float angle, _point p ) {
_point r;
// 1. translate point back to origin
// 2. rotate point
// 3. translate point back
r.x = cos(angle) * (p.x - c.x) - sin(angle) * (p.y - c.y) + c.x;
r.y = sin(angle) * (p.x - c.x) + cos(angle) * (p.y - c.y) + c.y;
return r;
}
this is the code
Consider that that particular board might be so cheap because it never worked.
... idk
New note: i fixed it and it is working but i print images on sd card to tft screen.
this is the code and library:
// IMPORTANT: LCDWIKI_SPI LIBRARY MUST BE SPECIFICALLY
// CONFIGURED FOR EITHER THE TFT SHIELD OR THE BREAKOUT BOARD.
//This program is a demo of how to display picture and
//how to use rotate function to display string.
//Set the pins to the correct ones for your development shield or breakout board.
//when using the BREAKOUT BOARD only and using these software spi lines to the LCD,
//there is no MISO pin and You can use any free pin to define the pins,for example
//pin usage as follow:
// CS CD RST MOSI MISO CLK LED
//Arduino Uno A5 A3 A4 A2 NONE A1 A3
//Arduino Mega A5 A3 A4 A2 NONE A1 A3
//when using the BREAKOUT BOARD only and using these hardware spi lines to the LCD,
//there is no MISO pin
//the MOSI pin and CLK pin is defined by the system and can't be modified.
//other pins can be defined by youself,for example
//pin usage as follow:
// CS CD RST MOSI MISO CLK LED
//Arduino Uno 10 9 8 11 NONE 13 A3
//Arduino Mega 10 9 8 51 NONE 52 A3
//Remember to set the pins to suit your display module!
#include <LCDWIKI_GUI.h> //Core graphics library
#include <LCDWIKI_SPI.h> //Hardware-specific library
LCDWIKI_SPI mylcd(ST7735S,A5,A3,-1,A2,A4,A1,A3);//software spi,model,cs,cd,miso,mosi,reset,clk,led
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
void fill_screen_test()
{
mylcd.Fill_Screen(BLACK);
mylcd.Fill_Screen(RED);
mylcd.Fill_Screen(GREEN);
mylcd.Fill_Screen(BLUE);
mylcd.Fill_Screen(BLACK);
}
void text_test()
{
mylcd.Set_Text_Mode(0);
mylcd.Fill_Screen(BLACK);
mylcd.Set_Text_Back_colour(BLACK);
mylcd.Set_Text_colour(WHITE);
mylcd.Set_Text_Size(1);
mylcd.Print_String("Hello World!", 0, 0);
mylcd.Set_Text_colour(YELLOW);
mylcd.Set_Text_Size(2);
mylcd.Print_Number_Float(1234.56,2,0, 8, '.', 0, ' ');
mylcd.Set_Text_colour(RED);
mylcd.Set_Text_Size(3);
mylcd.Print_Number_Int(0xDEADBEF, 0, 24, 0, ' ', 16);
mylcd.Set_Text_colour(GREEN);
mylcd.Set_Text_Size(4);
mylcd.Print_String("Groop", 0, 48);
mylcd.Set_Text_Size(2);
mylcd.Print_String("I implore,", 0, 80);
mylcd.Set_Text_Size(1);
mylcd.Print_String("my foonting turling.", 0, 96);
mylcd.Print_String("And hooptiously me", 0, 104);
mylcd.Print_String("with crinkly bindle,", 0, 112);
mylcd.Print_String("Or I will rend thee", 0, 120);
}
void lines_test(void)
{
mylcd.Fill_Screen(BLACK);
mylcd.Set_Draw_color(GREEN);
int i = 0;
for(i = 0; i< mylcd.Get_Display_Width();i+=5)
{
mylcd.Draw_Line(0, 0, i, mylcd.Get_Display_Height()-1);
}
for(i = mylcd.Get_Display_Height()-1; i>= 0;i-=5)
{
mylcd.Draw_Line(0, 0, mylcd.Get_Display_Width()-1, i);
}
mylcd.Fill_Screen(BLACK);
mylcd.Set_Draw_color(RED);
for(i = mylcd.Get_Display_Width() -1; i>=0;i-=5)
{
mylcd.Draw_Line(mylcd.Get_Display_Width()-1, 0, i, mylcd.Get_Display_Height()-1);
}
for(i = mylcd.Get_Display_Height()-1; i>=0;i-=5)
{
mylcd.Draw_Line(mylcd.Get_Display_Width()-1, 0, 0, i);
}
mylcd.Fill_Screen(BLACK);
mylcd.Set_Draw_color(BLUE);
for(i = 0; i < mylcd.Get_Display_Width();i+=5)
{
mylcd.Draw_Line(0, mylcd.Get_Display_Height()-1, i, 0);
}
for(i = 0; i < mylcd.Get_Display_Height();i+=5)
{
mylcd.Draw_Line(0, mylcd.Get_Display_Height()-1, mylcd.Get_Display_Width()-1, i);
}
mylcd.Fill_Screen(BLACK);
mylcd.Set_Draw_color(YELLOW);
for(i = mylcd.Get_Display_Width()-1; i >=0;i-=5)
{
mylcd.Draw_Line(mylcd.Get_Display_Width()-1, mylcd.Get_Display_Height()-1, i, 0);
}
for(i = 0; i<mylcd.Get_Display_Height();i+=5)
{
mylcd.Draw_Line(mylcd.Get_Display_Width()-1, mylcd.Get_Display_Height()-1, 0, i);
}
}
void h_l_lines_test(void)
{
int i=0;
mylcd.Fill_Screen(BLACK);
mylcd.Set_Draw_color(GREEN);
for(i =0;i<mylcd.Get_Display_Height();i+=5)
{
mylcd.Draw_Fast_HLine(0,i,mylcd.Get_Display_Width());
delay(5);
}
mylcd.Set_Draw_color(BLUE);
for(i =0;i<mylcd.Get_Display_Width();i+=5)
{
mylcd.Draw_Fast_VLine(i,0,mylcd.Get_Display_Height());
delay(5);
}
}
void rectangle_test(void)
{
int i = 0;
mylcd.Fill_Screen(BLACK);
mylcd.Set_Draw_color(GREEN);
for(i = 0;i<mylcd.Get_Display_Width()/2;i+=4)
{
mylcd.Draw_Rectangle(i,(mylcd.Get_Display_Height()-mylcd.Get_Display_Width())/2+i,mylcd.Get_Display_Width()-1-i,mylcd.Get_Display_Height()-(mylcd.Get_Display_Height()-mylcd.Get_Display_Width())/2-i);
delay(5);
}
}
void fill_rectangle_test(void)
{
int i = 0;
mylcd.Fill_Screen(BLACK);
mylcd.Set_Draw_color(YELLOW);
mylcd.Fill_Rectangle(0,(mylcd.Get_Display_Height()-mylcd.Get_Display_Width())/2,mylcd.Get_Display_Width()-1,mylcd.Get_Display_Height()-(mylcd.Get_Display_Height()-mylcd.Get_Display_Width())/2);
mylcd.Set_Draw_color(MAGENTA);
for(i = 0;i<mylcd.Get_Display_Width()/2;i+=4)
{
mylcd.Draw_Rectangle(i,(mylcd.Get_Display_Height()-mylcd.Get_Display_Width())/2+i,mylcd.Get_Display_Width()-1-i,mylcd.Get_Display_Height()-(mylcd.Get_Display_Height()-mylcd.Get_Display_Width())/2-i);
delay(5);
}
for(i = 0;i<mylcd.Get_Display_Width()/2;i+=4)
{
mylcd.Set_Draw_color(random(255), random(255), random(255));
mylcd.Fill_Rectangle(i,(mylcd.Get_Display_Height()-mylcd.Get_Display_Width())/2+i,mylcd.Get_Display_Width()-1-i,mylcd.Get_Display_Height()-(mylcd.Get_Display_Height()-mylcd.Get_Display_Width())/2-i);
delay(5);
}
}
void fill_circles_test(void)
{
int r=10,i=0,j=0;
mylcd.Fill_Screen(BLACK);
mylcd.Set_Draw_color(MAGENTA);
for(i=r;i<mylcd.Get_Display_Width();i+=2*r)
{
for(j=r;j<mylcd.Get_Display_Height();j+=2*r)
{
mylcd.Fill_Circle(i, j, r);
}
}
}
void circles_test(void)
{
int r=10,i=0,j=0;
mylcd.Set_Draw_color(GREEN);
for(i=0;i<mylcd.Get_Display_Width()+r;i+=2*r)
{
for(j=0;j<mylcd.Get_Display_Height()+r;j+=2*r)
{
mylcd.Draw_Circle(i, j, r);
}
}
}
void triangles_test(void)
{
int i = 0;
mylcd.Fill_Screen(BLACK);
for(i=0;i<mylcd.Get_Display_Width()/2;i+=5)
{
mylcd.Set_Draw_color(0,i+64,i+64);
mylcd.Draw_Triangle(mylcd.Get_Display_Width()/2-1,mylcd.Get_Display_Height()/2-1-i,
mylcd.Get_Display_Width()/2-1-i,mylcd.Get_Display_Height()/2-1+i,
mylcd.Get_Display_Width()/2-1+i,mylcd.Get_Display_Height()/2-1+i);
}
}
void fill_triangles_test(void)
{
int i = 0;
mylcd.Fill_Screen(BLACK);
for(i=mylcd.Get_Display_Width()/2-1;i>0;i-=5)
{
mylcd.Set_Draw_color(0,i+64,i+64);
mylcd.Fill_Triangle(mylcd.Get_Display_Width()/2-1,mylcd.Get_Display_Height()/2-1-i,
mylcd.Get_Display_Width()/2-1-i,mylcd.Get_Display_Height()/2-1+i,
mylcd.Get_Display_Width()/2-1+i,mylcd.Get_Display_Height()/2-1+i);
mylcd.Set_Draw_color(i,0,i);
mylcd.Draw_Triangle(mylcd.Get_Display_Width()/2-1,mylcd.Get_Display_Height()/2-1-i,
mylcd.Get_Display_Width()/2-1-i,mylcd.Get_Display_Height()/2-1+i,
mylcd.Get_Display_Width()/2-1+i,mylcd.Get_Display_Height()/2-1+i);
}
}
void round_rectangle(void)
{
int i = 0;
mylcd.Fill_Screen(BLACK);
for(i = 0;i<mylcd.Get_Display_Width()/2;i+=4)
{
mylcd.Set_Draw_color(255-i,0,160-i);
mylcd.Draw_Round_Rectangle(i,(mylcd.Get_Display_Height()-mylcd.Get_Display_Width())/2+i,mylcd.Get_Display_Width()-1-i,mylcd.Get_Display_Height()-(mylcd.Get_Display_Height()-mylcd.Get_Display_Width())/2-i,8);
delay(5);
}
}
void fill_round_rectangle(void)
{
int i = 0;
mylcd.Fill_Screen(BLACK);
for(i = 0;i<mylcd.Get_Display_Width()/2;i+=4)
{
mylcd.Set_Draw_color(255-i,160-i,0);
mylcd.Fill_Round_Rectangle(i,(mylcd.Get_Display_Height()-mylcd.Get_Display_Width())/2+i,mylcd.Get_Display_Width()-1-i,mylcd.Get_Display_Height()-(mylcd.Get_Display_Height()-mylcd.Get_Display_Width())/2-i,8);
delay(5);
}
}
void setup()
{
mylcd.Init_LCD();
fill_screen_test();
delay(500);
text_test();
delay(500);
lines_test();
delay(500);
h_l_lines_test();
delay(500);
rectangle_test();
delay(500);
fill_rectangle_test();
delay(500);
fill_circles_test();
delay(500);
circles_test();
delay(500);
triangles_test();
delay(500);
fill_triangles_test();
delay(500);
round_rectangle();
delay(500);
fill_round_rectangle();
delay(3000);
}
void loop()
{
for(uint8_t rotation=0; rotation<4; rotation++)
{
mylcd.Set_Rotation(rotation);
text_test();
delay(2000);
}
}
1.8.zip (4.2 MB)