TouchScreen Velleman VMA412

Hello, I have this error! Any help, please?

Thanks.

Post text, not pictures of text.

Use code tags for all the code and all the errors

@fabiofernandes_39, your topic has been moved to a more suitable section of the forum.

Can you please take some time to read How to get the best out of this forum (again?).

CODE 1:

//#define DEBUG

#include <FreeDefaultFonts.h>
#include <MCUFRIEND_kbv.h>
#include <mcufriend_serial.h>
#include <mcufriend_shield.h>
#include <mcufriend_special.h>
#include <mcufriend_special_2.h>
#include <TFT_HX8357GLUE.h>
#include <UTFTGLUE.h>
#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_TFTLCD.h> // Hardware-specific library
#include <TouchScreen.h>
#include <RTClib.h>
RTC_DS3231 rtc;

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


#define YP A1  // must be an analog pin, use "An" notation!
#define XM A2  // must be an analog pin, use "An" notation!
#define YM 7   // can be a digital pin
#define XP 6   // can be a digital pin

#define TS_MINX 150
#define TS_MINY 120
#define TS_MAXX 920
#define TS_MAXY 940

// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

// Assign human-readable names to some common 16-bit color values:
#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF
//#define ROZ     0xFD20
#define ROZ     0xFBE0
#define GRI     0xBDF7
// http://stackoverflow.com/questions/13720937/c-defined-16bit-high-color
// http://wiibrew.org/wiki/U16_colors

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

//Initialize any other variables here
#define MINPRESSURE 10
#define MAXPRESSURE 1000
extern uint8_t waterbucket[];
extern uint8_t settinglogo[];
extern uint8_t lightbulblogo[];
const int sensorPin1 = 23;
const int sensorPin2 = 24;
const int sensorPin3 = 25;
const int sensorPin4 = 26;
const int ledPin = 28;
const int ledPin2 = 30;
const int ledPin3 = 32;

int buttonState1 = 0;
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;

char currentPage;
const char *TOD[] = {"AM", "PM"};
int hours[] = {12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
int i = 8;
int j = 0;
int k = 2;
int l = 0;
int prevl = 0;
int prevj = 0;
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
int hoursOT;
int prevHour;
int minuteOT;
int prevMinute;
const char *AMPM;
const char *PrevAMPM;
int CurrDay;
int PrevDay;
int turnOFF;
int BM = 0;

void setup() {
  tft.reset();
  tft.begin(0x9341);
  Serial.begin(9600);
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }
  pinMode(sensorPin1, INPUT);
  pinMode(sensorPin2, INPUT);
  pinMode(sensorPin3, INPUT);
  pinMode(sensorPin4, INPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  currentPage = '0';
  drawHomeScreen();

}



void loop() {

  //HomePage
  if (currentPage == '0') {
    //Obtain current time and utilize TimeCheck function to print on screen
    DateTime now = rtc.now();
    if (prevMinute != now.minute()) {
      TimeCheck();
    }

    //Calculate the time at which to turn off the LEDs
    turnOFF = i + k;
    if (turnOFF > 23) {
      turnOFF = turnOFF - 24;
    }

    //Checking if the time is at or within the specified time to turn on the LEDs from 1am - 12pm
    if (now.hour() >= i && TOD[j] == "AM" && l == 0 && now.hour() < turnOFF) {
      digitalWrite(ledPin, HIGH);
      digitalWrite(ledPin2, HIGH);
      digitalWrite(ledPin3, HIGH);
      //Draw light bitmap on homescreen to indicate LED's are turned on; Only do this once so the home screen is
      //not continuously printing the bitmap
      if (BM == 0) {
        tft.drawBitmap(145, 185, lightbulblogo, 47, 50, YELLOW);
      }
      BM = 1;
    }
    //Checking if the time is at or within the specified time to turn on the LEDs from 1pm - 12am
    else if ((now.hour() - 12) >= i && TOD[j] == "PM" && l == 0 && (now.hour() - 12) < turnOFF) {
      digitalWrite(ledPin, HIGH);
      digitalWrite(ledPin2, HIGH);
      digitalWrite(ledPin3, HIGH);
      if (BM == 0) {
        tft.drawBitmap(145, 185, lightbulblogo, 47, 50, YELLOW);
      }
      BM = 1;
    }

    //If time of day equals the turn off LED time then shut off LEDs.
    //*Important to mention that this section only works for LEDs turning on during the day and the timer
    //does not run past midnight.The code will need to be adjusted should you want your LEDs to be on overnight*
    //Note: This works if the LED turn on time is set in the AM
    if (now.hour() == turnOFF && TOD[j] == "AM") {
      tft.fillRect(145, 185, 47, 50, BLACK);
      digitalWrite(ledPin, LOW);
      digitalWrite(ledPin2, LOW);
      digitalWrite(ledPin3, LOW);
      BM = 0;
    }
    //Note: This works if the LED turn on time is set in the PM
    else if (now.hour() - 12 == turnOFF && TOD[j] == "PM") {
      tft.fillRect(145, 185, 47, 50, BLACK);
      digitalWrite(ledPin, LOW);
      digitalWrite(ledPin2, LOW);
      digitalWrite(ledPin3, LOW);
      BM = 0;
    }

    //Get location of screen touch
    TSPoint p = ts.getPoint();
    pinMode(XM, OUTPUT);
    pinMode(YP, OUTPUT);

    //If Water Bucket is Selected --> will take you to the water soil plant screen
    if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
      p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
      p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);
      if (p.x > 0 && p.x < 100) {
        if (p.y > 0 && p.y < 100) {
          currentPage = '1';
          tft.fillScreen(BLACK);
          drawPlantScreen();
          soilCheck();
        }
      }

      //If Settings is Selected --> will take you to the setting LED timer screen
      if (p.x > 0 && p.x < 60) {
        if (p.y > 180 && p.y < 240) {
          currentPage = '2';
          tft.fillScreen(BLACK);
          drawSettingScreen();
        }
      }
    }
  }

  //Water Plants Page
  if (currentPage == '1') {
    TSPoint p = ts.getPoint();
    pinMode(XM, OUTPUT);
    pinMode(YP, OUTPUT);

    //If Back Button Pressed
    if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
      p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
      p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);
      if (p.x > 0 && p.x < 60) {
        if (p.y > 0 && p.y < 30) {
          currentPage = '0';
          tft.fillScreen(BLACK);
          drawHomeScreen();
          TimeCheck();
          BM = 0;
        }
      }
    }
  }

  //Settings Page
  if (currentPage == '2') {
    TSPoint p = ts.getPoint();
    pinMode(XM, OUTPUT);
    pinMode(YP, OUTPUT);

    //If left ON TIME arrow is pressed
    if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
      p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
      p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);
      //If left ON TIME arrow pressed
      if (p.x > 185 && p.x < 220) {
        if (p.y > 75 && p.y < 100) {
          tft.fillRect(195, 72, 35, 30, BLACK);
          tft.setCursor(195, 72);
          i = i - 1;
          if (i < 0) {
            i = 11;
          }
          tft.println(hours[i]);
          delay(500);
        }
      }
      //If right ON TIME arrow is pressed
      if (p.x > 185 && p.x < 220) {
        if (p.y > 115 && p.y < 140) {
          tft.fillRect(195, 72, 35, 30, BLACK);
          tft.setCursor(195, 72);
          i = i + 1;
          if (i > 11) {
            i = 0;
          }
          tft.println(hours[i]);
          delay(500);
        }
      }
      //Change AM or PM
      if (p.x > 185 && p.x < 220) {
        if (p.y > 170 && p.y < 195) {
          tft.fillRect(235, 72, 40, 30, BLACK);
          tft.setCursor(235, 72);
          j = 1;
          if (prevj == 1) {
            j = 0;
          }
          tft.println(TOD[j]);
          delay(500);
          prevj = j;
        }
      }
      //If left TIMER arrow is pressed
      if (p.x > 120 && p.x < 145) {
        if (p.y > 75 && p.y < 100) {
          tft.fillRect(195, 137, 35, 40, BLACK);
          tft.setCursor(195, 137);
          k = k - 1;
          if (k == 0) {
            k = 24;
          }
          tft.println(k);
          delay(500);
        }
      }
      //If right TIMER arrow is pressed
      if (p.x > 120 && p.x < 145) {
        if (p.y > 115 && p.y < 140) {
          tft.fillRect(195, 137, 35, 40, BLACK);
          tft.setCursor(195, 137);
          k = k + 1;
          if (k > 24) {
            k = 1;
          }
          tft.println(k);
          delay(500);
        }
      }

      //Selecting LED OFF Button will hard turn off the LEDs and keep them off
      if (p.x > 35 && p.x < 80) {
        if (p.y > 75 && p.y < 140) {
          l = 1;
          tft.drawRect(110, 190, 90, 25, RED);
          digitalWrite(ledPin, LOW);
          digitalWrite(ledPin2, LOW);
          digitalWrite(ledPin3, LOW);
          if (prevl == 1) {
            tft.drawRect(110, 190, 90, 25, WHITE);
            l = 0;
            if (hoursOT >= i && hoursOT < turnOFF) {
              digitalWrite(ledPin, HIGH);
              digitalWrite(ledPin2, HIGH);
              digitalWrite(ledPin3, HIGH);
            }
          }
          delay(500);
          prevl = l;
        }
      }


      //If Back Button Pressed --> will send back to the main page
      if (p.x > 0 && p.x < 60) {
        if (p.y > 0 && p.y < 30) {
          currentPage = '0';
          tft.fillScreen(BLACK);
          drawHomeScreen();
          TimeCheck();
          BM = 0;
        }
      }
    }
  }
}

//TimeCheck function obtains current time and date and prints to homescreen of LCD accordingly
void TimeCheck() {
  //Obtain current time information
  DateTime now = rtc.now();

  //Convert military time to standard time
  if (now.hour() > 12)
  {
    hoursOT = now.hour() - 12;
  }
  else {
    hoursOT = now.hour();
  }

  //Adjust AM or PM based on current time and check to see if there was a change from AM to PM or vice versa
  if (now.hour() > 11) {
    AMPM = "PM";
    if (PrevAMPM != AMPM) {
      tft.fillRect(265, 47, 40, 40, BLACK);
    }
    tft.setCursor(265, 47);
    tft.setTextSize(3);
    tft.print(AMPM);
  }
  else {
    AMPM = "AM";
    if (PrevAMPM != AMPM) {
      tft.fillRect(265, 47, 40, 30, BLACK);
    }
    tft.setCursor(265, 47);
    tft.setTextSize(3);
    tft.print(AMPM);
  }
  PrevAMPM = AMPM;

  //Check to see if current time is a new hour and correct display accordingly
  tft.setTextSize(7);
  if (prevHour != hoursOT) {
    if (hoursOT < 10) {
      tft.fillRect(45, 20, 80, 50, BLACK);
      tft.setCursor(85, 20);
      tft.print(hoursOT);
    }
    else {
      tft.fillRect(45, 20, 80, 50, BLACK);
      tft.setCursor(45, 20);
      tft.print(hoursOT);
    }
  }
  else {
    if (hoursOT < 10) {
      tft.setCursor(85, 20);
      tft.print(hoursOT);
    }
    else {
      tft.setCursor(45, 20);
      tft.print(hoursOT);
    }
  }
  prevHour = hoursOT;

  //Print colon and current minute
  tft.print(":");
  minuteOT = now.minute();

  //Checks current time and updates screen if new time
  if (prevMinute != minuteOT) {
    tft.fillRect(165, 20, 85, 50, BLACK);
    if (minuteOT < 10) {
      tft.print("0");
      tft.print(minuteOT);
    }
    else {
      tft.print(minuteOT);
    }
  }
  else {
    if (minuteOT < 10) {
      tft.print("0");
      tft.print(minuteOT);
    }
    else {
      tft.print(minuteOT);
    }
  }
  prevMinute = minuteOT;


  //Obtains current day of the week, month, day, and year; Prints to screen and checks to see if there is a new day
  CurrDay = now.day();
  if (CurrDay != PrevDay) {
    tft.fillRect(50, 100, 270, 15, BLACK);
    tft.setTextSize(2);
    tft.setCursor(50, 100);
    tft.print(daysOfTheWeek[now.dayOfTheWeek()]);
    tft.setCursor(180, 100);
    tft.print(now.month());
    tft.print("/");
    tft.print(now.day());
    tft.print("/");
    tft.print(now.year());
  }
  else {
    tft.setTextSize(2);
    tft.setCursor(50, 100);
    tft.print(daysOfTheWeek[now.dayOfTheWeek()]);
    tft.setCursor(180, 100);
    tft.print(now.month());
    tft.print("/");
    tft.print(now.day());
    tft.print("/");
    tft.print(now.year());
  }
  PrevDay = CurrDay;
}

//soilCheck function reads digitial input of soil sensor and indicates which of the 4 plants needs to be watered
//Circles that are filled in solid green indicate that they are dry and neet to be watered.
void soilCheck() {
  buttonState1 = digitalRead(sensorPin1);
  buttonState2 = digitalRead(sensorPin2);
  buttonState3 = digitalRead(sensorPin3);
  buttonState4 = digitalRead(sensorPin4);
  if (buttonState1 == HIGH) {
    tft.fillCircle(110, 80, 45, GREEN);
  }
  else if (buttonState1 == LOW) {
    tft.fillCircle(110, 80, 44, BLACK);
  }
  if (buttonState2 == HIGH) {
    tft.fillCircle(110, 180, 45, GREEN);
  }
  else if (buttonState2 == LOW) {
    tft.fillCircle(110, 180, 44, BLACK);
  }
  if (buttonState3 == HIGH) {
    tft.fillCircle(232, 80, 45, GREEN);
  }
  else if (buttonState3 == LOW) {
    tft.fillCircle(232, 80, 44, BLACK);
  }
  if (buttonState4 == HIGH) {
    tft.fillCircle(232, 180, 45, GREEN);
  }
  else if (buttonState4 == LOW) {
    tft.fillCircle(232, 180, 44, BLACK);
  }
}

//drawPlantScreen function draws the plant soil screen
void drawPlantScreen() {
  tft.setRotation(3);
  tft.drawRect(89, 4, 164, 27, WHITE);
  tft.fillRect(90, 5, 162, 25, BLUE);
  tft.setCursor(100, 10);
  tft.setTextSize(2.5);
  tft.println("WATER PLANTS");
  tft.drawRect(4, 208, 62, 27, WHITE);
  tft.fillRect(5, 209, 60, 25, BLUE);
  tft.setCursor(15, 211);
  tft.setTextSize(3);
  tft.println("<-");
  tft.drawCircle(110, 80, 45, GREEN);
  tft.drawCircle(110, 180, 45, GREEN);
  tft.drawCircle(232, 80, 45, GREEN);
  tft.drawCircle(232, 180, 45, GREEN);

}

//drawSettingScreen draws the setting screen
void drawSettingScreen() {
  //Draws title "SET LED TIME" and outlines it in a rectangle box
  tft.setRotation(3);
  tft.drawRect(89, 4, 164, 27, WHITE);
  tft.fillRect(90, 5, 162, 25, RED);
  tft.setCursor(100, 10);
  tft.setTextSize(2.5);
  tft.println("SET LED TIME");

  //Draws "ON TIME" as well as left and right arrows
  tft.drawRect(4, 70, 90, 25, WHITE);
  tft.fillRect(5, 71, 88, 23, BLUE);
  tft.setCursor(8, 75);
  tft.println("ON TIME");
  tft.drawRect(110, 70, 20, 25, WHITE);
  tft.fillRect(111, 71, 18, 23, BLUE);
  tft.setCursor(114, 75);
  tft.println("<");
  tft.drawRect(155, 70, 20, 25, WHITE);
  tft.fillRect(156, 71, 18, 23, BLUE);
  tft.setCursor(159, 75);
  tft.println(">");

  //Draws TIMER as well as left and right arrows
  tft.drawRect(4, 135, 90, 25, WHITE);
  tft.fillRect(5, 136, 88, 23, BLUE);
  tft.setCursor(18, 140);
  tft.println("TIMER");
  tft.drawRect(110, 135, 20, 25, WHITE);
  tft.fillRect(111, 136, 18, 23, BLUE);
  tft.setCursor(114, 140);
  tft.println("<");
  tft.drawRect(155, 135, 20, 25, WHITE);
  tft.fillRect(156, 136, 18, 23, BLUE);
  tft.setCursor(159, 140);
  tft.println(">");

  //Checks to see if hard set LED OFF button has been pressed in the past and draws text/rectangle accordingly
  tft.setTextSize(2.5);
  if (l == 1) {
    tft.drawRect(110, 190, 90, 25, RED);
  }
  else {
    tft.drawRect(110, 190, 90, 25, WHITE);
  }
  tft.fillRect(111, 191, 88, 23, BLUE);
  tft.setCursor(114, 195);
  tft.println("LED OFF");

  //Draws "HRS" next to TIMER numbers
  tft.setCursor(235, 137);
  tft.setTextSize(3);
  tft.println("HRS");

  //Draws current TIMER time
  tft.fillRect(195, 137, 35, 30, BLACK);
  tft.setCursor(195, 137);
  tft.println(k);

  //Draws back arrow
  tft.drawRect(4, 208, 62, 27, WHITE);
  tft.fillRect(5, 209, 60, 25, RED);
  tft.setCursor(15, 211);
  tft.setTextSize(3);
  tft.println("<-");

  //Draws current ON TIME time as well as "AM" or "PM"
  tft.fillRect(195, 72, 35, 30, BLACK);
  tft.setCursor(195, 72);
  tft.println(hours[i]);
  tft.fillRect(235, 72, 40, 30, BLACK);
  tft.setCursor(235, 72);
  tft.println(TOD[j]);
}

//drawHomescreen draws the homescreen of the display
void drawHomeScreen() {
  tft.setRotation(3);
  tft.setTextColor(WHITE);
  tft.setTextSize(7);
  tft.fillScreen(BLACK);
  tft.drawBitmap(10, 185, waterbucket, 74, 50, BLUE);
  tft.drawBitmap(270, 190, settinglogo, 40, 40, GRI);
}

CODE 2:

#include <avr/pgmspace.h>

const unsigned char waterbucket []PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x07, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf8, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x03, 0xf0, 0x00, 0x3c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf8, 0x00, 0x78, 
0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x38, 0x00, 0xf0, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x1c, 0x3c, 0x00, 0xe0, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x1c, 0x01, 0xe0, 0x1c, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x70, 0x1c, 0x3f, 0xf8, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x1d, 
0xff, 0xff, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x1f, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 
0x00, 0x00, 0xe0, 0x1f, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1f, 0xff, 0xff, 
0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1f, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 
0xe0, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1f, 0xff, 0xff, 0xff, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x70, 0x3f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x1f, 0x80, 0x00, 0x70, 0x7f, 
0xff, 0xff, 0xff, 0x80, 0x1e, 0x3f, 0x80, 0x00, 0x78, 0x7f, 0xff, 0xff, 0xff, 0x80, 0x3f, 0x00, 
0x00, 0x00, 0x3c, 0xff, 0xff, 0xff, 0xff, 0x80, 0x3f, 0x80, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 
0xff, 0x00, 0x3f, 0xc0, 0x0e, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0x00, 0x3f, 0xcf, 0x07, 0x80, 
0x0f, 0xff, 0xff, 0xff, 0xff, 0x00, 0x1f, 0xc7, 0xc3, 0xc0, 0x07, 0xff, 0xff, 0xff, 0xfe, 0x00, 
0x3f, 0xe1, 0xc3, 0x80, 0x07, 0xff, 0xff, 0xff, 0xfe, 0x00, 0xff, 0xe0, 0xc0, 0x00, 0x0f, 0xff, 
0xff, 0xff, 0xfe, 0x01, 0xff, 0xc0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xfc, 0x07, 0xe7, 0xc0, 
0x04, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xc3, 0x83, 0x06, 0x00, 0x1f, 0xff, 0xff, 0xff, 
0xfc, 0x7f, 0x00, 0x01, 0x87, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xf9, 0xfe, 0x00, 0x01, 0xc3, 0x80, 
0x3f, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x01, 0xc3, 0x80, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xf0, 
0x00, 0x01, 0xc1, 0x80, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 
0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 
0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 
0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x0f, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xc0, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 
0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x3f, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00};

const unsigned char settinglogo []PROGMEM = {
  0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 
0x00, 0x83, 0x00, 0x00, 0x00, 0xc0, 0x81, 0x03, 0x00, 0x01, 0xe3, 0x81, 0xc7, 0xc0, 0x03, 0x3f, 
0x81, 0xfc, 0xe0, 0x06, 0x1c, 0x00, 0x38, 0x60, 0x0c, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 
0x00, 0x30, 0x06, 0x00, 0x00, 0x00, 0x60, 0x07, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0xff, 0x00, 
0xc0, 0x03, 0x01, 0xe7, 0x80, 0xc0, 0x06, 0x03, 0x00, 0xc0, 0x60, 0x06, 0x06, 0x00, 0x60, 0x60, 
0x7e, 0x0c, 0x00, 0x30, 0x7e, 0xf0, 0x0c, 0x00, 0x30, 0x0f, 0xc0, 0x0c, 0x00, 0x30, 0x03, 0xc0, 
0x08, 0x00, 0x10, 0x03, 0xc0, 0x08, 0x00, 0x10, 0x03, 0xc0, 0x0c, 0x00, 0x30, 0x03, 0xe0, 0x0c, 
0x00, 0x30, 0x0f, 0x7e, 0x0c, 0x00, 0x30, 0x7e, 0x06, 0x06, 0x00, 0x60, 0x60, 0x06, 0x03, 0x00, 
0xc0, 0x60, 0x03, 0x01, 0xe7, 0x80, 0xc0, 0x03, 0x00, 0xff, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 
0xe0, 0x06, 0x00, 0x00, 0x00, 0x60, 0x0c, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x00, 0x30, 
0x06, 0x1c, 0x00, 0x38, 0x60, 0x03, 0x3f, 0x81, 0xfc, 0xc0, 0x01, 0xf3, 0x81, 0xcf, 0x80, 0x00, 
0xc0, 0x81, 0x03, 0x00, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x00, 
0xff, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00
};

const unsigned char lightbulblogo []PROGMEM = {
  0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x07, 0x00, 
0x00, 0xe0, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x70, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x38, 0x00, 0x00, 
0x38, 0x00, 0x00, 0x10, 0x0f, 0xe0, 0x10, 0x00, 0x00, 0x00, 0x3f, 0xf8, 0x00, 0x00, 0x00, 0x00, 
0xe7, 0xfe, 0x00, 0x00, 0x00, 0x01, 0x87, 0xff, 0x00, 0x00, 0x00, 0x03, 0x0f, 0xff, 0x80, 0x00, 
0x00, 0x06, 0x1f, 0xff, 0xc0, 0x00, 0x00, 0x04, 0x7f, 0xff, 0xc0, 0x00, 0x00, 0x0c, 0x7f, 0xff, 
0xe0, 0x00, 0x00, 0x0c, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x08, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x19, 
0xff, 0xff, 0xf0, 0x00, 0x7f, 0x1f, 0xff, 0xff, 0xf1, 0xfc, 0x2e, 0x1f, 0xff, 0xff, 0xf0, 0xe8, 
0x00, 0x1f, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x0f, 0xff, 0xff, 
0xe0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x07, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x07, 
0xff, 0xff, 0xc0, 0x00, 0x00, 0x03, 0xff, 0xff, 0x80, 0x00, 0x00, 0x01, 0xff, 0xff, 0x00, 0x00, 
0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x38, 0x7f, 0xfc, 
0x38, 0x00, 0x00, 0x70, 0x3f, 0xf8, 0x1c, 0x00, 0x00, 0xe0, 0x3f, 0xf8, 0x0e, 0x00, 0x01, 0xc0, 
0x1f, 0xf0, 0x07, 0x00, 0x00, 0x80, 0x1f, 0xf0, 0x02, 0x00, 0x00, 0x00, 0x1f, 0xf0, 0x00, 0x00, 
0x00, 0x00, 0x3f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x3f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xe0, 0x00, 0x00, 
0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00
};

ERROR:

In file included from C:\Users\16294\Desktop\Indoor_Flower_Pot\Indoor_Flower_Pot.ino:6:0:
C:\Users\16294\Documents\Arduino\libraries\MCUFRIEND_kbv/mcufriend_special_2.h:1:2: error: #elif without #if
#elif defined(SAM3X8E) && defined(USE_MEGA_16BIT_SHIELD) //regular CTE shield on DUE
^~~~
Foram encontradas múltiplas bibliotecas para «TouchScreen.h»
Utilizado: C:\Users\16294\Documents\Arduino\libraries\TouchScreen
Não utilizado: C:\Users\16294\Documents\Arduino\libraries\Adafruit_TouchScreen
exit status 1
Erro ao compilar para a placa Arduino Mega or Mega 2560.

what part didn't you get about reading the forums rules and using code tags ?


please edit your post, select the code part and press the </> icon in the tool bar to mark it as code. It's unreadable as it stands. (also make sure you indented the code in the IDE before copying, that's done by pressing ctrlT on a PC or cmdT on a Mac)

I'm sorry but I'm new to this, because I need help to complete my project. I tried to do what you asked me to do.

Foram encontradas múltiplas bibliotecas para «TouchScreen.h»

it seems you have multiple TouchScreen libraries installed

clean up your Library folder to ensure you only keep the one you want to use

I did it now and that error disappeared. But the error of the library "mcufriend_special_2.h" still remains.

In file included from C:\Users\16294\Desktop\sketch_jun01a\sketch_jun01a.ino:8:0:
C:\Users\16294\Documents\Arduino\libraries\MCUFRIEND_kbv/mcufriend_special_2.h:1:2: error: #elif without #if
#elif defined(SAM3X8E) && defined(USE_MEGA_16BIT_SHIELD) //regular CTE shield on DUE
^~~~

then that library is bogus... did you download the production version?

Yes. I downloaded the version that the brand had available for that model. From what I realized the error comes from a library that is poorly structured.

I'm not sure why this gets compiled the path shows it's in the unused directory

I also didn't do many things and nothing ...
This error is annoying.
But thank you very much.

Have you tried the examples provided with the library to see if you can get your screen to work?
then work from there

With the examples it works, it just doesn't work in this code because it turns white.

I thought it would not compile

if you use smaller icons (in PROGMEM) do you have issues ?

The Velleman screen comes with download links to obsolete libraries.

I strongly advise you to delete any library directory that you installed from the Velleman download.

Run the IDE Library Manager. Install the genuine versions of libraries via the Library Manager.

Then build and run all the examples e.g. from MCUFRIEND_kbv
Make sure that they work properly. Ask if you have a problem.
Quote the example by name. Describe the problem. Copy-Paste any output from the Serial Terminal.

Are you using a Uno or a MEGA2560 ?
I2C devices like DS3231 do not work with your Screen on a Uno. But they should work on the MEGA2560.

Your "program" in #1 shows that you are very new to programming. There are MANY things that are wrong.

Which is why it is best to start with the genuine library examples.

Then we can help you with your own project(s).

David.

Edit. It looks as if some masochist has moved your thread from Displays to Programming Questions. "Displays" is far more appropriate (if you expect me to answer)

What do you mean small icons?

what you have in there and the others

const unsigned char waterbucket []PROGMEM = {

with the fonts etc there might be some issues in how the data is set in flash memory (far pointer)

I am using MEGA2560.
Okay, I'm going to do this to see if it works.
Thanks

we just had that discussion with another forum member