Keep DMD LED Matrix Showing a Message with Arduino Mega

I'm facing some issues when I want to display some messages with my DMD LED Matrix.

This GIF shows what's happening:

I want to keep the lights on and just update the value under the text.
Obs.: DMD is the library I use to display my messages with a Chinese LED Matrix.

You can see the code below:


#include <SPI.h>
#include <DMD2.h>
#include <fonts/Arial_Black_16.h>
#include "WiFiEsp.h"
#include "ArduinoJson.h"

//http://35.198.41.210:8080/perguntometro

const int WIDTH = 3; //number of panels wide
const uint8_t *FONT = Arial_Black_16;

SoftDMD dmd(WIDTH, 1);
DMD_TextBox box(dmd);

char ssid[] = "Cubo-Residentes";             // your network SSID (name)
char pass[] = "Welcome2Cubao";               // your network password
int status = WL_IDLE_STATUS;                 // the Wifi radio's status

char server[] = "35.198.41.210";
char buffer[255];

unsigned long lastConnectionTime = 0;      // last time you connected to the server, in milliseconds
const unsigned long postingInterval = 100; // delay between updates, in milliseconds

// Initialize the Ethernet client object
WiFiEspClient client;

void setup()
{
  // initialize serial for debugging
  Serial.begin(9600);
  // initialize serial for ESP module
  Serial2.begin(115200);
  // initialize ESP module
  WiFi.init(&Serial2);

  // check for the presence of the shield
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue
    while (true);
  }


  // attempt to connect to WiFi network
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network
    status = WiFi.begin(ssid, pass);
  }

  Serial.println("You're connected to the network");

  printWifiStatus();

}

void loop()
{

  // if there's incoming data from the net connection send it out the serial port
  // this is for debugging purposes only
  while (client.available()) {
    char c = client.read();
    Serial.write(c);
  }

  // if 10 seconds have passed since your last connection,
  // then connect again and send data
  if (millis() - lastConnectionTime > postingInterval) {
    httpRequest();
  }

}

// this method makes a HTTP connection to the server
void httpRequest()
{
  Serial.println();

  // close any connection before send a new request
  // this will free the socket on the WiFi shield
  client.stop();

  // if there's a successful connection
  if (client.connect(server, 8080)) {
    Serial.println("Connecting...");
    // send the HTTP PUT request
    client.println(F("GET http://35.198.41.210:8080/perguntometro"));

    while (!client.available()) {}
    int a = client.read(buffer, 255);

    const size_t bufferSize = JSON_OBJECT_SIZE(2) + 50;
    DynamicJsonBuffer jsonBuffer(bufferSize);
    JsonObject& root = jsonBuffer.parseObject(buffer);

    long int count = root["questionCount"];
    Serial.print("Count:");
    Serial.println(count);

    dmd.setBrightness(255);
    dmd.selectFont(FONT);
    dmd.begin();

    char buf[40];
    dmd.drawString(1, 1, format(count, buf, 10));
    delay(3000);

    dmd.end();

    // note the time that the connection was made
    lastConnectionTime = millis();
  }
  else {
    // if you couldn't make a connection
    Serial.println("Connection failed");
  }
}


void printWifiStatus()
{
  // print the SSID of the network you're attached to
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print the received signal strength
  long rssi = WiFi.RSSI();
  Serial.print("Signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}

char *recursive(unsigned long val, char *s, unsigned radix, int pos)
{
  int c;

  if (val >= radix)
    s = recursive(val / radix, s, radix, pos + 1);
  c = val % radix;
  c += (c < 10 ? '0' : 'a' - 10);
  *s++ = c;
  if (pos % 3 == 0) *s++ = '.';
  return s;
}

char *format(long val, char *s, int radix)
{
  if (radix < 2 || radix > 36) {
    s[0] = 0;
  } else {
    char *p = s;
    if (radix == 10 && val < 0) {
      val = -val;
      *p++ = '-';
    }
    p = recursive(val, p, radix, 0) - 1;
    *p = 0;
  }
  return s;
}

OK, beginner's instructions:

You need to go and read the forum instructions so that you can go back and modify your original post (not re-post it) - using the "More -> Modify" option below the right hand corner of your post - to mark up your code as such using the "</>" icon in the posting window. Just highlight each section of code (or output) from the IDE and click the icon. In fact, the IDE has a "copy for forum" link to put these markings on a highlighted block for you so you then just paste it here in a posting window.

It is inappropriate to attach it as a ".ino" file. People can usually see the mistakes directly and do not want to have to actually load it in their own IDE. And that would also assume they are using a PC and have the IDE running on that PC.

But don't forget to use the "Auto-Format" (Ctrl-T) option first to make it easy to read. If you do not post it as "code", it can be quite garbled and is always more difficult to read.

Also tidy up your blank space. Use blank lines only between functional blocks.