Bonjour,
je viens à vous car je planche depuis pas mal de temps sur une interface pour une caisse à outils automatisée. Celle ci commencerait par un petit text sur la 1ère page suivit d'une page ou seront affichées les valeurs de mon capteur DHT22 avec le logo de mon entreprise dans un coins de l'écran.
j'ai déjà réussis à tout configurer... Pas si mal pour un débutant mais je ne cache pas que j'y ai passé beaucoups de temps mais c'est très gratifiant quand cela prend forme..
La 1ère page de mon affichage est ok l'affichage de mon DHT22 mais je n'arrive pas à y afficher mon logo.
J'ai fais un programme avec les librairie <SD.h> <SPI.h> et <TFT.h> pas de soucis ,j'arrive à afficher ce logo depuis un arduino Mega sur un ST7735 carte SD incluse, mais je n'arrive pas à afficher les valeures de mon DHT11.
Des que j'insert PImage logo; j'ai 'PImage does not a name type qui apparaît lors de la compilation.
ayant les mêmes librairies dans mes 2 programmes je n'arrive pas à comprendre pourquoi cela fonctionne dans 1 mais pas dans l'autre..!?
Inutile de vous précisez que j'ai plus ou moins tout essayé pendant plusieurs jours mais je n'arrive pas à passer ce cap malgré de nombreuses recherches sur la toile..
//Librairies>>
#include <SPI.h>
#include <SD.h>
//------------------BME280--------->
#include <Wire.h>
#include <Adafruit_BME280.h> // include Adafruit BME280 sensor library
#define BME280_I2C_ADDRESS 0x77
Adafruit_BME280 bme280;
//-----------------ST7735---------->
const int SD_CS = 4;
const int TFT_CS = 10;
const int TFT_DC = 9;
const int TFT_RST = 8;
#include <Adafruit_GFX.h> // include Adafruit graphics library
#include <Adafruit_ST7735.h> // include Adafruit ST7735 TFT library
// initialize ST7735 TFT library
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
PImage logo; //Variable du LOGO zuglogo7
PImage logo1; //Variable du LOGO1 micro zug
void setup()
{
//---Initialisation du TFT------>
tft.initR(INITR_BLACKTAB); // initialize a ST7735S chip, black tab
tft.fillScreen(ST7735_BLACK);
tft.setRotation(1); // Rotation de l'écran paysage
//---Initialisation du moniteur série à 115200 bauds
Serial.begin(115200);
Serial.print(F("Initialisation du moniteur série...ok "));
//Initialisation de la varte SD------>
Serial.print(F("Initialisation SD card..."));
if (!SD.begin(SD_CS))
{
Serial.println(F("failed!"));
return;
}
Serial.println(F(" OK!"));
delay (500);
//void drawbitmap(uint8_t x, uint8_t y, const uint8_t *bitmap, uint8_t w, uint8_t h, uint8_t color);
//delay(5000);
tft.fillScreen(ST7735_BLACK);
tft.drawRect(0,0,160,128,ST77XX_BLUE);
tft.drawRect(120,88,30,30,ST77XX_BLUE);
tft.setTextColor(ST7735_RED, ST7735_BLACK);
tft.println( );
tft.println(F(" "));
tft.println(F(" Arduino TFT Bitmap "));
tft.println(F(" par "));
tft.setTextColor(ST7735_WHITE);
tft.println(F(" "));
tft.setTextSize(1); //taille des caracteres
tft.println(F(" xxx@gmail.com "));
tft.println(F(" "));
tft.setTextColor(ST7735_BLUE);
tft.println(F(" Ouverture "));
tft.println(F(" du Moniteur serie "));
tft.println(F(" "));
tft.println(F(" "));
tft.println(F(" "));
tft.println(F(" Lancement de la "));
tft.println(F(" procedure dans "));
tft.println(F(" "));
//---Compte à rebour initialisation--->>
tft.setTextSize(2); //taille des caracteres
tft.setTextColor(ST7735_RED);
tft.setCursor(130, 97);
tft.print("5");
delay (1000);
tft.setTextColor(ST7735_BLACK);
tft.setCursor(130, 97);
tft.print("5");
tft.setTextColor(ST7735_RED);
tft.setCursor(130, 97);
tft.print("4");
delay (1000);
tft.setTextColor(ST7735_BLACK);
tft.setCursor(130, 97);
tft.print("4");
tft.setTextColor(ST7735_RED);
tft.setCursor(130, 97);
tft.print("3");
delay (1000);
tft.setTextColor(ST7735_BLACK);
tft.setCursor(130, 97);
tft.print("3");
tft.setTextColor(ST7735_RED);
tft.setCursor(130, 97);
tft.print("2");;
delay (1000);
tft.setTextColor(ST7735_BLACK);
tft.setCursor(130, 97);
tft.print("2");
tft.setTextColor(ST7735_RED);
tft.setCursor(130, 97);
tft.print("1");
delay (750);
//---Initialisation du BME280------>
if( bme280.begin(BME280_I2C_ADDRESS) == 0 )
{ // connection error or device address wrong!
tft.setTextColor(ST7735_RED, ST7735_BLACK); // set text color to red and black background
tft.setTextSize(2); // text size = 2
tft.setCursor(8, 76); // move cursor to position (5, 76) pixel
tft.print("Connection");
tft.setCursor(35, 100); // move cursor to position (35, 100) pixel
tft.print("Error");
while(1); // stay here
}
tft.fillScreen(ST7735_BLACK);
tft.setTextSize(1);
//---Initialisation des affichages statiques------>
tft.setTextColor(ST7735_RED, ST7735_BLACK); // set text color to red and black background
tft.setCursor(5,7); tft.print("TEMPERATURE ="); // move cursor to position (25, 39) pixel
tft.setTextColor(ST7735_CYAN, ST7735_BLACK);
tft.setCursor(5,43); tft.print("HUMIDITE=");
tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
tft.setCursor(5, 79); tft.print("PRESION ATMOS. =");
tft.setTextSize(2);
tft.drawRect(0,0,160,128,ST77XX_BLUE);
}
void loop()
{
char _buffer[8];
// read temperature, humidity and pressure from the BME280 sensor
float temp = bme280.readTemperature(); // get temperature in °C
float humi = bme280.readHumidity(); // get humidity in rH%
float pres = bme280.readPressure(); // get pressure in Pa
// affichage de la température(en °C)
if(temp < 0) // if temperature < 0
sprintf( _buffer, "-%02u.%02u", (int)abs(temp), (int)(abs(temp) * 100) % 100 );
else // temperature >= 0
sprintf( _buffer, " %02u.%02u", (int)temp, (int)(temp * 100) % 100 );
tft.setTextColor(ST7735_YELLOW, ST7735_BLACK); // set text color to yellow and black background
tft.setCursor(0, 20); tft.print(_buffer);//Affiche la température à 1, 20
tft.drawCircle(78, 22, 2, ST7735_YELLOW); // print degree symbol ( ° )
tft.setCursor(85, 22); tft.print("C");//print C de celsius a 85,20
// 2: print humidity
sprintf( _buffer, "%02u.%02u %%", (int)humi, (int)(humi * 100) % 100 );
tft.setTextColor(ST7735_MAGENTA, ST7735_BLACK); // set text color to magenta and black background
tft.setCursor(15,58); tft.print(_buffer);
// 3: print pressure (in hPa)
sprintf( _buffer, "%04u.%02u", (int)(pres/100), (int)((uint32_t)pres % 100) );
tft.setTextColor(0xFD00, ST7735_BLACK); // set text color to orange and black background
tft.setCursor(15, 92);tft.print(_buffer); //Print pression
tft.setCursor(103, 92);tft.print("hPa");
delay(1000); // wait a second
}
Voici l'erreur que j'obtient
'PImage' does not name a type
A savoir que si je re-compile le tout mais sans la déclaration de PImage logo, tout est ok..
Merci d'avance pour vos lumières..[/code]