TFT LCD Modul a Arduino UNO

Odpovědět
OFryauf
Příspěvky: 1
Registrován: 25 pro 2017, 23:00
Reputation: 0

TFT LCD Modul a Arduino UNO

Příspěvek od OFryauf » 25 pro 2017, 23:34

Ahoj,
mám problém s tímto:https://store.arduino.cc/arduino-lcd-screen displayem.
Nainstaloval jsem všechny knihovny které jsou na arduino.cc napsány jako potřebné, otevřel jsem v Arduino IDE ten nejzákladnější příklad pro "zobrazení" loga Arduina, jenže ani kompilace neproběhla úspěšně..
Používám tento kód:

Kód: Vybrat vše

/*

 Arduino TFT Bitmap Logo example
 
 This example reads an image file from a micro-SD card
 and draws it on the screen, at random locations.
 
 In this sketch, the Arduino logo is read from a micro-SD card.
 There is a .bmp file included with this sketch. 
 - open the sketch folder (Ctrl-K or Cmd-K)
 - copy the "arduino.bmp" file to a micro-SD
 - put the SD into the SD slot of the Arduino TFT module.
 
 This example code is in the public domain.
 
 Created 19 April 2013 by Enrico Gueli
 
 http://arduino.cc/en/Tutorial/TFTBitmapLogo
 
 */
 
// include the necessary libraries
#include <SPI.h>
#include <SD.h>
#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <TFT.h>            // Arduino LCD library

// pin definition for the Uno
#define sd_cs  4
#define lcd_cs 10
#define dc     9
#define rst    8  

// pin definition for the Leonardo
//#define sd_cs  8
//#define lcd_cs 7
//#define dc     0
//#define rst    1  

TFT TFTscreen = TFT(lcd_cs, dc, rst);

// this variable represents the image to be drawn on screen
PImage logo;


void setup() {
  // initialize the GLCD and show a message
  // asking the user to open the serial line
  TFTscreen.begin();
  TFTscreen.background(255, 255, 255);

  TFTscreen.stroke(0, 0, 255);
  TFTscreen.println();
  TFTscreen.println("Arduino TFT Bitmap Example");
  TFTscreen.stroke(0, 0, 0);
  TFTscreen.println("Open serial monitor");
  TFTscreen.println("to run the sketch");

  // initialize the serial port: it will be used to 
  // print some diagnostic info  
  Serial.begin(9600);
  while (!Serial) {
    // wait for serial line to be ready
  }

  // clear the GLCD screen before starting
  TFTscreen.background(255, 255, 255);
  
  // try to access the SD card. If that fails (e.g.
  // no card present), the setup process will stop.
  Serial.print("Initializing SD card...");
  if (!SD.begin(sd_cs)) {
    Serial.println("failed!");
    return;
  }
  Serial.println("OK!");
  
  // initialize and clear the GLCD screen
  TFTscreen.begin();
  TFTscreen.background(255, 255, 255);

  // now that the SD card can be access, try to load the
  // image file.
  logo = TFTscreen.loadImage("arduino.bmp");
  if (!logo.isValid()) {
    Serial.println("error while loading arduino.bmp");
  }
}

void loop() {
  // don't do anything if the image wasn't loaded correctly.
  if (logo.isValid() == false) {
    return;
  }
  
  Serial.println("drawing image");

  // get a random location where to draw the image.
  // To avoid the image to be draw outside the screen,
  // take into account the image size.
  int x = random(TFTscreen.width() - logo.width());
  int y = random(TFTscreen.height() - logo.height());

  // draw the image to the screen
  TFTscreen.image(logo, x, y);

  // wait a little bit before drawing again
  delay(1500);
}
Vypsal se tento error:

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Kód: Vybrat vše

Arduino: 1.8.5 (Windows 10), Vývojová deska: "Arduino/Genuino Uno"

TFTBitmapLogo:44: error: 'PImage' does not name a type

 PImage logo;

 ^

C:\Users\ondra\Documents\Arduino\libraries\TFT-master\examples\Arduino\TFTBitmapLogo\TFTBitmapLogo.ino: In function 'void setup()':

TFTBitmapLogo:51: error: 'class TFT' has no member named 'background'

   TFTscreen.background(255, 255, 255);

             ^

TFTBitmapLogo:53: error: 'class TFT' has no member named 'stroke'

   TFTscreen.stroke(0, 0, 255);

             ^

TFTBitmapLogo:56: error: 'class TFT' has no member named 'stroke'

   TFTscreen.stroke(0, 0, 0);

             ^

TFTBitmapLogo:68: error: 'class TFT' has no member named 'background'

   TFTscreen.background(255, 255, 255);

             ^

TFTBitmapLogo:81: error: 'class TFT' has no member named 'background'

   TFTscreen.background(255, 255, 255);

             ^

TFTBitmapLogo:85: error: 'logo' was not declared in this scope

   logo = TFTscreen.loadImage("arduino.bmp");

   ^

TFTBitmapLogo:85: error: 'class TFT' has no member named 'loadImage'

   logo = TFTscreen.loadImage("arduino.bmp");

                    ^

C:\Users\ondra\Documents\Arduino\libraries\TFT-master\examples\Arduino\TFTBitmapLogo\TFTBitmapLogo.ino: In function 'void loop()':

TFTBitmapLogo:93: error: 'logo' was not declared in this scope

   if (logo.isValid() == false) {

       ^

TFTBitmapLogo:102: error: 'logo' was not declared in this scope

   int x = random(TFTscreen.width() - logo.width());

                                      ^

TFTBitmapLogo:106: error: 'class TFT' has no member named 'image'

   TFTscreen.image(logo, x, y);

             ^

Byly nalezené násobné knihovny "TFT.h"
 Použitý: C:\Program Files (x86)\Arduino\libraries\TFT
 Nepoužitý: C:\Users\ondra\Documents\Arduino\libraries\TFT-master
Byly nalezené násobné knihovny "SD.h"
 Použitý: C:\Users\ondra\Documents\Arduino\libraries\SD
 Nepoužitý: C:\Program Files (x86)\Arduino\libraries\SD
exit status 1
'PImage' does not name a type
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Mohl by mi někdo prosím vás poradit? já fakt nevím co s tim...Předem děkuji všem za odpovědi :-)
OFryauf

zbysek
Site Admin
Příspěvky: 125
Registrován: 22 úno 2017, 15:18
Reputation: 0

Re: TFT LCD Modul a Arduino UNO

Příspěvek od zbysek » 26 pro 2017, 19:40

Ahoj, odkud jsi knihovny stáhl?
Jakou verzi Arduino IDE máš?

Odpovědět

Kdo je online

Uživatelé prohlížející si toto fórum: Žádní registrovaní uživatelé a 29 hostů