Libraries don't work together

So i'm running into trouble when making use of the MCUFRIEND_k + TouchScreen and the WiFi.h + SPI together. They both work fine on their own, but not together.

Little context on my project and the exact problem. I've set up a c# server where the arduino connects to, with the help of an wifi shield. The arduino will send (and later on receive) messages to the server. When not making use of any tft functions all the messages gets send to the server, but as soon as I add an simple tft.fillScreen(WHITE); it will only send the message from the set up and sometimes even none.

My code:

//             LIBRARIES
#include <MCUFRIEND_kbv.h>
#include <TouchScreen.h>

#include <WiFi.h>
#include <SPI.h>

//              WiFi & Server
char ssid[] = "***";
char pass[] = "***";

IPAddress server(192, 168, 178, 81);
IPAddress device(192, 168, 178, 5);

WiFiClient client; // creates a client which connects to the server
int status = WL_IDLE_STATUS;

//             DEFINING COLOURS
#define BLACK 0x0000
#define LIGHTGREY 0xC618
#define DARKGREY 0x7BEF
#define RED 0xF800
#define WHITE 0xFFFF
#define DARKGREEN 0x1D60

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

const int XP = 8, XM = A2, YP = A3, YM = 9; //ID=0x9341
const int TS_LEFT = 0, TS_RT = 240, TS_TOP = 0, TS_BOT = 320;

#define MINPRESSURE 10
#define MAXPRESSURE 1000

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

MCUFRIEND_kbv tft;

String threshold = "comfort";

uint16_t ID, oldcolor, currentcolor;
uint8_t Orientation = 0;    //PORTRAIT

//                SET UP
void setup() {

  uint16_t ID = tft.readID();
  status = WiFi.begin(ssid, pass);
  Serial.println("connected to the network");
  client.connect(server, 1844);
  Serial.print("connected to the server. Server IP : ");

void loop()

You failed to tell us what hardware you're using, there is no wiring diagram and there are no links to the non-standard libraries.

Without the necessary information we cannot help you.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.