5'' TFT screen suddenly doesn't register touch

I have a 5'' TFT display with touchscreen using the SSD1963 controller connected to an Arduino Mega.

I have been working on a project for a few weeks now and everything worked almost perfectly, but now suddenly it doesn't register any touches.

Last time I tried it on friday, everything worked fine. Today I just made some formatting changes to the code, uploaded it to the Mega and the touch doesn't work anymore.

I triple checked the code, couldn't find anything wrong. Does anybody have an idea what could be the problem?

Here's a part of the code, second and third in the comments but only in 10 min because I can only post every 5 minutes, sorry.

#include <SoftwareSerial.h>

#include <ccTalk.h>
#include <headers.h>

#include <memorysaver.h>
#include <UTFT.h>
#include <URTouch.h>
#include <URTouchCD.h>
#include <SPI.h>
#include <RF24.h>
#include <RF24Network.h>
#include <Servo.h>

//==== Defining Variables and constants
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];
int x, y;
int currentPage;
int selectedDevice = 0;
int jamPos = 0;
int numOfCoins;
int xR = 100;
char dataReceived[4]; // This must match dataToSend in the TX
bool jammed = false;
bool stopped = false;
int servoStartPos = 0;
int servoEndPos = 90;
unsigned long startServo;
unsigned long stopServo;
unsigned long servoTime = 5000;
unsigned long servoPressTime = 500;
unsigned long testStart;
unsigned long testEnd;
unsigned long testRunningEnd;
unsigned long elapsedTime = 0;
unsigned long runningTime = 0;
int testRuns = 0;
int servoFlag = 0;
int hopperRuns = 0;

//==== Hopper control
int address = 3;
int msglength = 5;              // Minimum size, every data bit adds 1
int enable = 165;               // A5H
unsigned long int totalCoins;   // future use - ADD
int dataArray[] = {0, 0, 0};    // future use - ADD

//==== Inputs
#define CE 9 
#define CSN 10
#define ROUTE_DETECTOR 8 // Should be as many pins as the number of light barriers on the external route, or just one pin with external logic
#define TOUCH_ORIENTATION  LANDSCAPE

//==== Outputs
#define LIFT1_2 11
#define SERVO 7

//==== Creating Objects
UTFT    myGLCD(SSD1963_800, 38, 39, 40, 41); // Parameters should be adjusted to your Display/Shield model
URTouch  myTouch( 6, 5, 4, 3, 2);
RF24 radio(CE, CSN);
RF24Network network(radio);
const uint16_t this_node = 00;
Servo myServo;

SoftwareSerial hopperSerial(12, 13); // RX, TX
ccTalk hopper(&hopperSerial);

void setup() {

  // Initial setup
  myGLCD.InitLCD();
  myGLCD.clrScr();
  myTouch.InitTouch(TOUCH_ORIENTATION);
  myTouch.setPrecision(PREC_MEDIUM);

  drawHomeScreen();  // Draws the Home Screen
  currentPage = 0; // Indicates that we are at Home Screen

  Serial.begin(9600);
  hopperSerial.begin(9600); // Start serial for external hopper
  Serial.println("Rx Starting");
  SPI.begin();
  radio.begin();
  network.begin(90, this_node);
  radio.setDataRate( RF24_250KBPS );

  pinMode(LIFT1_2, OUTPUT);
  pinMode(SERVO, OUTPUT);
  pinMode(10, OUTPUT); // Mega is master

  digitalWrite(LIFT1_2, LOW);
  digitalWrite(ROUTE_DETECTOR, LOW);

  myServo.attach(SERVO);
  myServo.write(servoStartPos);

  hopper.comm_init();
  while ( hopper.RX_state != ccTalk::RXidle) {
    hopper.ccTalkReceive();
    Serial.println("ccTalkReceiveIdle");
  }
  if (hopper.RX_state != ccTalk::RXcomplete) {
    Serial.println(hopper.RX_msg[hopper.RX_state]);
  }
  msglength = 1;
  hopper.cctsend(enable_hopper, address, msglength, enable);
  hopper.startrx();
  while ( hopper.RX_state < ccTalk::RXcomplete) {
    hopper.ccTalkReceive();
    Serial.println("ccTalkReceiveComplete");
  }
  if (hopper.RX_state != ccTalk::RXcomplete) {
    Serial.println(hopper.RX_msg[hopper.RX_state]);
  }
}

void loop() {

  /*** main menu
        select device
         set amount of coins
         start test
  ***/

  //==== Home Screen
  if (currentPage == 0) {
    if (myTouch.dataAvailable()) {
      myTouch.read();
      x = myTouch.getX(); // X coordinate where the screen has been pressed
      y = myTouch.getY(); // Y coordinates where the screen has been pressed

      // WALL Button
      if ((x >= 98) && (x <= 350) && (y >= 131) && (y <= 249)) {
        drawFrame(98, 131, 350, 249); // Custom Function -Highlighs the buttons when it's pressed
        Serial.println("WALL");
        currentPage = 1; // Indicates that we are at the Config page
        selectedDevice = 0; // Saves the selection
        myGLCD.clrScr(); // Clears the screen
        drawConfigPage(0); // It is called only once, because in the next iteration of the loop, this above if statement will be false so this funtion won't be called.
      }
      // SLANT Button
      if ((x >= 450) && (x <= 702) && (y >= 131) && (y <= 249)) {
        drawFrame(450, 131, 702, 249);
        Serial.println("SLANT");
        currentPage = 1;
        selectedDevice = 1;
        myGLCD.clrScr();
        drawConfigPage(1);
      }
      // TWIN Button
      if ((x >= 98) && (x <= 350) && (y >= 299) && (y <= 417)) {
        drawFrame(98, 299, 350, 417);
        Serial.println("TWIN");
        currentPage = 1;
        selectedDevice = 2;
        myGLCD.clrScr();
        drawConfigPage(2);
      }
      // GRAND Button
      if ((x >= 450) && (x <= 702) && (y >= 299) && (y <= 417)) {
        drawFrame(450, 299, 702, 417);
        Serial.println("GRAND");
        currentPage = 1;
        selectedDevice = 3;
        myGLCD.clrScr();
        drawConfigPage(3);
      }
    }
  }

  //==== Config Page
  if (currentPage == 1) {
    setNumOfCoins();
    if (myTouch.dataAvailable()) {
      myTouch.read();
      x = myTouch.getX();
      y = myTouch.getY();

      // Back Button
      if ((x >= 21) && (x <= 100) && (y >= 99) && (y <= 149)) {
        drawFrame(21, 99, 100, 149);
        currentPage = 0; // Indicates we are at home screen
        myGLCD.clrScr();
        drawHomeScreen(); // Draws the home screen
      }
      // Start button
      if ((x >= 234) && (x <= 567) && (y >= 366) && (y <= 435)) {
        drawFrame(234, 366, 567, 435);
        testStart = millis();
        digitalWrite(LIFT1_2, HIGH);
        digitalWrite(CSN, LOW);
        startServo = millis();
        currentPage = 2; // Indicates we are at test screen
        myGLCD.clrScr();
        drawTestPage(); // Draws the test screen
      }
    }
  }

  //==== Test running
  if (currentPage == 2) {
    runTest();
    if (myTouch.dataAvailable()) {
      myTouch.read();
      x = myTouch.getX();
      y = myTouch.getY();

      // Stop button
      if ((x >= 234) && (x <= 567) && (y >= 366) && (y <= 435)) {
        drawFrame(234, 366, 567, 435);
        testEnd = millis();
        currentPage = 3; // Indicates we are at report screen
        myGLCD.clrScr();
        digitalWrite(LIFT1_2, LOW); // stops lift1_2
        //stop the hopper
        msglength = 0;
        hopper.cctsend(emergency_stop, address, msglength);
        hopper.startrx();
        while ( hopper.RX_state < ccTalk::RXcomplete) {
          hopper.ccTalkReceive();
          Serial.println("ccTalkReceiveStop");
        }
        if (hopper.RX_state != ccTalk::RXcomplete) {
          Serial.println(hopper.RX_msg[hopper.RX_state]);
        }
        stopped = true;
        drawReportPage(); // Draws the report screen
      }

      // Hopper button - just for testing REMOVE
      if ((x >= 22) && (x <= 175) && (y >= 366) && (y <= 435)) {
        drawFrame(22, 366, 175, 435);
        hopperPayout();
      }
    }
  }

  //==== Test results
  if (currentPage == 3) {
    if (myServo.read() != servoStartPos) {
      myServo.write(servoStartPos);
    }
    if (myTouch.dataAvailable()) {
      myTouch.read();
      x = myTouch.getX();
      y = myTouch.getY();

      // Main menu button
      if ((x >= 234) && (x <= 567) && (y >= 366) && (y <= 435)) {
        drawFrame(234, 366, 567, 435);
        currentPage = 0;
        testRuns = 0;
        jammed = false;
        stopped = false;

        // Reset hopper
        msglength = 0;
        hopper.cctsend(reset_device, address, msglength);
        hopper.startrx();
        while ( hopper.RX_state < ccTalk::RXcomplete) {
          hopper.ccTalkReceive();
          Serial.println("ccTalkReceiveReset");
        }
        if (hopper.RX_state != ccTalk::RXcomplete) {
          Serial.println(hopper.RX_msg[hopper.RX_state]);
        }
        hopperRuns = 0;
        myGLCD.clrScr();
        drawHomeScreen();
      }
    }
  }

}

Second part of the code:

void drawHomeScreen() {

  // Title
  myGLCD.setBackColor(0, 0, 0); // Sets the background color of the area where the text will be printed to black
  myGLCD.setColor(255, 255, 255); // Sets color to white
  myGLCD.setFont(BigFont); // Sets font to big
  myGLCD.print("Coin Flow Tester", CENTER, 25); // Prints the string on the screen
  myGLCD.setFont(SmallFont); // Sets the font to small
  myGLCD.print("Bally-Wulff Games & Entertainment", CENTER, 54); // Prints the string
  myGLCD.setColor(255, 0, 0); // Sets color to red
  myGLCD.drawLine(0, 80, 799, 80); // Draws the red line

  // Button - Wall
  myGLCD.setColor(16, 167, 103); // Sets green color
  myGLCD.fillRoundRect (98, 131, 350, 249); // Draws filled rounded rectangle
  myGLCD.setColor(255, 255, 255); // Sets color to white
  myGLCD.drawRoundRect (98, 131, 350, 249); // Draws rounded rectangle without a fill, so the overall appearance of the button looks like it has a frame
  myGLCD.setFont(BigFont); // Sets the font to big
  myGLCD.setBackColor(16, 167, 103); // Sets the background color of the area where the text will be printed to green, same as the button
  myGLCD.print("WALL", 182, 180); // Prints the string

  // Button - Slant
  myGLCD.setColor(16, 167, 103);
  myGLCD.fillRoundRect (450, 131, 702, 249);
  myGLCD.setColor(255, 255, 255);
  myGLCD.drawRoundRect (450, 131, 702, 249);
  myGLCD.setFont(BigFont);
  myGLCD.setBackColor(16, 167, 103);
  myGLCD.print("SLANT", 530 , 180);

  // Button - Twin
  myGLCD.setColor(16, 167, 103);
  myGLCD.fillRoundRect (98, 299, 350, 417);
  myGLCD.setColor(255, 255, 255);
  myGLCD.drawRoundRect (98, 299, 350, 417);
  myGLCD.setFont(BigFont);
  myGLCD.setBackColor(16, 167, 103);
  myGLCD.print("TWIN", 185, 348);

  // Button - Grand
  myGLCD.setColor(16, 167, 103);
  myGLCD.fillRoundRect (450, 299, 702, 417);
  myGLCD.setColor(255, 255, 255);
  myGLCD.drawRoundRect (450, 299, 702, 417);
  myGLCD.setFont(BigFont);
  myGLCD.setBackColor(16, 167, 103);
  myGLCD.print("GRAND", 525, 348);
}

void drawFrame(int x1, int y1, int x2, int y2) {
  myGLCD.setColor(255, 0, 0);
  myGLCD.drawRoundRect (x1, y1, x2, y2);
  while (myTouch.dataAvailable())
    myTouch.read();
  myGLCD.setColor(255, 255, 255);
  myGLCD.drawRoundRect (x1, y1, x2, y2);
}

void drawConfigPage(int device) {
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.setColor(255, 255, 255);
  myGLCD.setFont(BigFont);
  myGLCD.print("Coin Flow Tester", CENTER, 25);
  myGLCD.setFont(SmallFont);
  myGLCD.print("Bally-Wulff Games & Entertainment", CENTER, 54);
  myGLCD.setColor(255, 0, 0);
  myGLCD.drawLine(0, 80, 799, 80);

  myGLCD.setColor(100, 155, 203);
  myGLCD.fillRoundRect (21, 99, 100, 149);
  myGLCD.setColor(255, 255, 255);
  myGLCD.drawRoundRect (21, 99, 100, 149);
  myGLCD.setFont(BigFont);
  myGLCD.setBackColor(100, 155, 203);
  myGLCD.print("<--", 45, 119);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.setFont(BigFont);
  myGLCD.print("Selected Device:", 181, 137);
  myGLCD.print("Number of coins:", 175, 208);

  switch (device) {
    case 0:
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.setColor(16, 167, 103);
      myGLCD.setFont(BigFont);
      myGLCD.print("WALL", 519, 137);
      break;
    case 1:
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.setColor(16, 167, 103);
      myGLCD.setFont(BigFont);
      myGLCD.print("SLANT", 519, 137);
      break;
    case 2:
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.setColor(16, 167, 103);
      myGLCD.setFont(BigFont);
      myGLCD.print("TWIN", 519, 137);
      break;
    case 3:
      myGLCD.setBackColor(0, 0, 0);
      myGLCD.setColor(16, 167, 103);
      myGLCD.setFont(BigFont);
      myGLCD.print("GRAND", 519, 137);
      break;
  }

  // Coin amount slider
  myGLCD.setColor(255, 255, 255);
  myGLCD.drawRect(100, 271, 700, 321);

  // Start button
  myGLCD.setColor(16, 167, 103);
  myGLCD.fillRoundRect (234, 366, 567, 435);
  myGLCD.setColor(255, 255, 255);
  myGLCD.drawRoundRect (234, 366, 567, 435);
  myGLCD.setFont(BigFont);
  myGLCD.setBackColor(16, 167, 103);
  myGLCD.print("START TEST", 330, 392);

}

void drawTestPage() {
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.setColor(255, 255, 255);
  myGLCD.setFont(BigFont);
  myGLCD.print("Coin Flow Tester", CENTER, 25);
  myGLCD.setFont(SmallFont);
  myGLCD.print("Bally-Wulff Games & Entertainment", CENTER, 54);
  myGLCD.setColor(255, 0, 0);
  myGLCD.drawLine(0, 80, 799, 80);
  myGLCD.setFont(BigFont);
  myGLCD.print("TEST RUNNING", 180, 118);

  myGLCD.setColor(255, 255, 255);
  myGLCD.setFont(BigFont);
  myGLCD.print("Test runs:", 186, 206);
  myGLCD.print("Coins:", 233, 293);

  // Stop button
  myGLCD.setColor(255, 0, 0);
  myGLCD.fillRoundRect (234, 366, 567, 435);
  myGLCD.setColor(255, 255, 255);
  myGLCD.drawRoundRect (234, 366, 567, 435);
  myGLCD.setFont(BigFont);
  myGLCD.setBackColor(255, 0, 0);
  myGLCD.print("STOP TEST", 336, 392);

  // Hopper button - just for testing REMOVE
  myGLCD.setColor(100, 155, 203);
  myGLCD.fillRoundRect (22, 366, 175, 435);
  myGLCD.setColor(255, 255, 255);
  myGLCD.drawRoundRect (22, 366, 175, 435);
  myGLCD.setFont(BigFont);
  myGLCD.setBackColor(100, 155, 203);
  myGLCD.print("HOPPER", 50, 392);

}

void drawReportPage() {
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.setColor(255, 255, 255);
  myGLCD.setFont(BigFont);
  myGLCD.print("Coin Flow Tester", CENTER, 25);
  myGLCD.setFont(SmallFont);
  myGLCD.print("Bally-Wulff Games & Entertainment", CENTER, 54);
  myGLCD.setColor(255, 0, 0);
  myGLCD.drawLine(0, 80, 799, 80);

  elapsedTime = testEnd - testStart;
  testTime(elapsedTime);

  if (stopped) {
    myGLCD.setColor(255, 0, 0);
    myGLCD.setFont(BigFont);
    myGLCD.print("TEST STOPPED", CENTER, 107);
  }
  else if (jammed) {
    switch (jamPos) {
      case 1:
        myGLCD.setColor(255, 0, 0);
        myGLCD.setFont(BigFont);
        myGLCD.print("JAMMED -- POSITION 1", CENTER, 107);
        break;
      case 2:
        myGLCD.setColor(255, 0, 0);
        myGLCD.setFont(BigFont);
        myGLCD.print("JAMMED -- POSITION 2", CENTER, 107);
        break;
      case 3:
        myGLCD.setColor(255, 0, 0);
        myGLCD.setFont(BigFont);
        myGLCD.print("JAMMED -- EXTERNAL ROUTE", CENTER, 107);
        break;
    }
  }

  myGLCD.setColor(255, 255, 255);
  myGLCD.setFont(BigFont);
  myGLCD.print("Test runs:", 176, 151);
  myGLCD.print("Coins in/out:", 135, 230);
  myGLCD.setColor(255, 0, 0);
  myGLCD.setFont(BigFont);
  myGLCD.print("Test time:", 176, 314);

  // Main menu button
  myGLCD.setColor(16, 167, 103);
  myGLCD.fillRoundRect (234, 366, 567, 435);
  myGLCD.setColor(255, 255, 255);
  myGLCD.drawRoundRect (234, 366, 567, 435);
  myGLCD.setFont(BigFont);
  myGLCD.setBackColor(16, 167, 103);
  myGLCD.print("MAIN MENU", 335, 392);

}

void setNumOfCoins() {
  if (myTouch.dataAvailable()) {
    myTouch.read();
    x = myTouch.getX();
    y = myTouch.getY();
    if ( (y >= 271) && (y <= 321)) {
      xR = x; // Stores the X value where the screen has been pressed in to variable xR
      if (xR <= 100) { // Confines the area of the slider to be above 100 pixels
        xR = 100;
      }
      if (xR >= 700) { // Confines the area of the slider to be under 700 pixels
        xR = 700;
      }
    }
  }
  // Maps the values of the X - Axis from 100 to 0 and 700 to 190
  int xRC = map(xR, 100, 700, 0, 190);

  // Stores the selected number of coins and prints it on the screen
  numOfCoins = xRC;
  myGLCD.setFont(SevenSegNumFont);
  myGLCD.setColor(0, 255, 0);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.printNumI(numOfCoins, 519, 210, 3, '0');

  // Draws the positioners
  myGLCD.setColor(255, 255, 255);
  myGLCD.fillRect(xR, 270, (xR + 4), 320); // Positioner
  myGLCD.setColor(xRC, 0, 0);
  myGLCD.fillRect(100, 270, (xR - 1), 320);
  myGLCD.setColor(0, 0, 0);
  myGLCD.fillRect((xR + 5), 270, 700, 320);
}

Third part:

void runTest() {
  testRuns++;
  testRunningEnd = millis();
  runningTime = testRunningEnd - testStart;
  testRunningTimer(runningTime);

  // Start hopper payout and press button after some time - ADD

  digitalWrite(LIFT1_2, HIGH);

  delay(500); // Wait for lifts to start
  if (servoFlag == 0) {
    myServo.write(servoStartPos);
    hopperPayout();
    servoFlag = 1;
  }
  if (servoFlag == 1) {
    stopServo = millis();
    if (stopServo - startServo >= servoTime) {
      myServo.write(servoEndPos);
      delay(servoPressTime);
      servoFlag = 0;
      startServo = millis();
    }
  }

  network.update();
  while (network.available()) {
    Serial.println("Test -- network available");
    RF24NetworkHeader header;
    network.peek(header);

    if (header.type == '1') {
      network.read(header, &dataReceived, sizeof(dataReceived));
      testEnd = millis();
      Serial.print(testEnd);
      Serial.print(" Jammed at ");
      Serial.println(dataReceived);
      jammed = true;
      jamPos = 1;
    }
    if (header.type == '2') {
      network.read(header, &dataReceived, sizeof(dataReceived));
      testEnd = millis();
      Serial.print(testEnd);
      Serial.print(" Jammed at ");
      Serial.println(dataReceived);
      jammed = true;
      jamPos = 2;
    }
  }

  int route = digitalRead(ROUTE_DETECTOR);
  if (route == HIGH) {
    testEnd = millis();
    Serial.print(testEnd);
    Serial.print(" Jammed at external route!");
    jammed = true;
    jamPos = 3;
  }

  if (jammed == true) {
    digitalWrite(LIFT1_2, LOW);         // Stops lift1_2
    // Hopper emergency stop
    msglength = 0;
    hopper.cctsend(emergency_stop, address, msglength);
    hopper.startrx();
    while ( hopper.RX_state < ccTalk::RXcomplete) {
      hopper.ccTalkReceive();
      Serial.println("ccTalkReceiveStop");
    }
    if (hopper.RX_state != ccTalk::RXcomplete) {
      Serial.println(hopper.RX_msg[hopper.RX_state]);
    }
    // Request hopper dispense count - ADD
    currentPage = 3;
    myGLCD.clrScr();
    drawReportPage();
  }
}

void testTime(unsigned long x) {
  long int hours   = (int) (x / 3600000);
  long int minutes = (int) ((x - (hours * 3600000)) / (60000));
  long int seconds = (int) ((x - ((hours * 3600000) + (minutes * 60000))) / 1000);

  myGLCD.setFont(SevenSegNumFont);
  myGLCD.setColor(0, 255, 0);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.printNumI(testRuns, 440, 140, 5, '0');

  // Display coins in/out - ADD

  myGLCD.setFont(SevenSegNumFont);
  myGLCD.setColor(0, 255, 0);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.printNumI(hours, 390, 300, 2, '0');
  myGLCD.setFont(BigFont);
  myGLCD.print("H", 455, 300);
  myGLCD.setFont(SevenSegNumFont);
  myGLCD.printNumI(minutes, 470, 300, 2, '0');
  myGLCD.setFont(BigFont);
  myGLCD.print("M", 535, 300);
  myGLCD.setFont(SevenSegNumFont);
  myGLCD.printNumI(seconds, 550, 300, 2, '0');
  myGLCD.setFont(BigFont);
  myGLCD.print("S", 615, 300);

}

void testRunningTimer(unsigned long x) {
  long int hours   = (int) (x / 3600000);
  long int minutes = (int) ((x - (hours * 3600000)) / (60000));
  long int seconds = (int) ((x - ((hours * 3600000) + (minutes * 60000))) / 1000);


  myGLCD.setFont(SevenSegNumFont);
  myGLCD.setColor(0, 255, 0);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.printNumI(testRuns, 440, 190, 5, '0');

  // Display Hopper dispense count - ADD

  myGLCD.setFont(SevenSegNumFont);
  myGLCD.setColor(0, 255, 0);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.printNumI(hours, 390, 100, 2, '0');
  myGLCD.setFont(BigFont);
  myGLCD.print("H", 455, 100);
  myGLCD.setFont(SevenSegNumFont);
  myGLCD.printNumI(minutes, 470, 100, 2, '0');
  myGLCD.setFont(BigFont);
  myGLCD.print("M", 535, 100);
  myGLCD.setFont(SevenSegNumFont);
  myGLCD.printNumI(seconds, 550, 100, 2, '0');
  myGLCD.setFont(BigFont);
  myGLCD.print("S", 615, 100);

  myGLCD.setFont(SevenSegNumFont);
  myGLCD.setColor(0, 255, 0);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.printNumI(hopperRuns * numOfCoins, 360, 275, 7, '0');

}

void hopperPayout() {
  Serial.print("Hopper coins payout: ");
  Serial.println(numOfCoins);
  msglength = 9;
  hopper.cctsend(dispense_hopper_coins, address, msglength, 0, 0, 0, numOfCoins);
  hopper.startrx();
  while ( hopper.RX_state < ccTalk::RXcomplete) {
    hopper.ccTalkReceive();
    Serial.println("ccTalkReceiveComplete");
  }
  if (hopper.RX_state != ccTalk::RXcomplete) {
    Serial.println(hopper.RX_msg[hopper.RX_state]);
  }
  hopperRuns++;
}