• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
TFT nie hasa
#2
Witam,

Spróbuj wgrać tego sketcha - moja kompilacja Smile
Oprócz testu ekranu, testuje również dotyk na ekranie wyświetlając współrzędne.

Spróbuj również wgrać najpierw sketcha do UNO bez zamontowanego TFT.
I dopiero po wgraniu włożyć TFT (oczywiście na wyłączonym ARDUINO)
Chociaż u mnie wgrywa się bez problemu razem z schieldem...

Pozdr.

Kod:
// HELLO WORLD

#include <SPFD5408_Adafruit_TFTLCD.h>
#include <SPFD5408_TouchScreen.h>

#define YP A2
#define XM A3
#define YM 8  
#define XP 9

#define MINPRESSURE 250
#define MAXPRESSURE 350

TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
#define LCD_RESET A4

#define BLACK   tft.color565(0,0,0)
#define RED     tft.color565(255,0,0)
#define GREEN   tft.color565(0,255,0)
#define BLUE    tft.color565(0,0,255)
#define WHITE   tft.color565(255,255,255)

Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

//----------------------------------Ustawienia programu -----------------------------------------
void setup(void)
{
 Serial.begin(9600);

 tft.reset();
 tft.begin(0x9341); // SDFP5408
 tft.setRotation(3);
 tft.fillScreen(BLACK);

 testText();

 tft.drawLine(0, 0, 319, 0, GREEN);
 tft.drawLine(0, 239, 319, 239, GREEN);
 tft.drawLine(0, 0, 0, 239, GREEN);
 tft.drawLine(319, 0, 319, 239, GREEN);
}

//--------------------------------- Pętla główna programu ----------------------------------------
void loop(void)
{
 TSPoint p = ts.getPoint();

 if (p.z > 0)
 {
   Serial.print(p.x);
   Serial.print(" ");
   Serial.print(p.y);
   Serial.print(" ");
   Serial.print(p.z);
   Serial.println();
 }

 pinMode(XM, OUTPUT);
 pinMode(YP, OUTPUT);

 if(p.z > 0)
 {
   tft.fillScreen(BLACK);
   testText();

   tft.setTextColor(WHITE);  
   tft.setTextSize(3);

   tft.setCursor(80, 120);
   tft.print("p.x = ");
   tft.println(p.x);

   tft.setCursor(80, 150);
   tft.print("p.y = ");
   tft.println(p.y);

   tft.drawLine(65, 110, 250, 110, WHITE);
   tft.drawLine(65, 185, 250, 185, WHITE);
   tft.drawLine(65, 110, 65, 185, WHITE);
   tft.drawLine(250, 110, 250, 185, WHITE);
 }
}

//----------------------------------------------- testText -----------------------------------------
unsigned long testText()
{
 tft.fillScreen(BLACK);

 tft.setTextColor(WHITE);  
 tft.setTextSize(4);
 tft.setCursor(0, 20);
 tft.println(" Hello World!");

 tft.setTextColor(RED);
 tft.setTextSize(2);
 tft.setCursor(5, 80);
 tft.println("ARDUINO SHIELD LCD TFT 2.4");

 tft.setCursor(220, 225);
 tft.setTextColor(BLUE);  
 tft.setTextSize(1);
 tft.println("ZERO Point --->");
}

//------------------------------------------ TSPoint waitOneTouch -----------------------------------
TSPoint waitOneTouch()
{
 TSPoint p;

 do
 {
   p= ts.getPoint();
   pinMode(XM, OUTPUT);
   pinMode(YP, OUTPUT);
 }
 while((p.z < MINPRESSURE ) || (p.z > MAXPRESSURE));

 return p;
}
Jeżeli pomogłem, to poproszę o punkt reputacji Big Grin
 
Odpowiedź
  


Wiadomości w tym wątku
TFT nie hasa - przez ferdricco - 09-10-2016, 22:53
RE: TFT nie hasa - przez ANT - 10-10-2016, 19:18
RE: TFT nie hasa - przez ferdricco - 13-10-2016, 21:44
RE: TFT nie hasa - przez ANT - 14-10-2016, 15:36
RE: TFT nie hasa - przez armata165 - 16-10-2016, 18:08
RE: TFT nie hasa - przez ferdricco - 16-10-2016, 20:36
RE: TFT nie hasa - przez armata165 - 17-10-2016, 17:16
RE: TFT nie hasa - przez ferdricco - 13-02-2017, 21:43
RE: TFT nie hasa - przez silverskorpion - 01-11-2016, 22:09
RE: TFT nie hasa - przez yarpen - 02-11-2016, 17:43
RE: TFT nie hasa - przez armata165 - 02-11-2016, 22:20
RE: TFT nie hasa - przez yarpen - 03-11-2016, 14:38
RE: TFT nie hasa - przez SQ4KDG - 11-12-2016, 02:11
RE: TFT nie hasa - przez ferdricco - 13-02-2017, 21:47
RE: TFT nie hasa - przez AntoniG - 13-02-2018, 19:59

Skocz do:


Przeglądający: 1 gości