error compiling for TFT button

Hey,
I'm using the on/off button code for a adafruit 2.8 TFT screen(2.8 TFT Touch Shield for Arduino with Resistive Touch Screen : ID 1651 : $34.95 : Adafruit Industries, Unique & fun DIY electronics and kits) and the code works fine but when I added a second button to the screen and a second bit of code to run if it is pushed I get an error (expected primary-expression before 'void') at the void double(); line of code in my second button.

I have looked around but it's hard to look for something when you don't know what to search for so if anyone can point me in the right direction I would appreciate it.

Here's the code

#include <Wire.h>
#include <Stepper.h>

Stepper myStepper1 = Stepper(200, 5, 6);  //table slider pin 5 and 6
Stepper myStepper2 = Stepper(200, 3, 4);  //substrate rotate pin 8 and 9

const int gluemac = 7;            // pin to actuate glue machine relay
const int button = 2;            // pin button is on
int val = 0;                        // current button state
int old_val = 0;
int state = 0;


#include <Adafruit_GFX.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_ILI9341.h>
#include <Adafruit_STMPE610.h>

// This is calibration data for the raw touch data to the screen coordinates
#define TS_MINX 150
#define TS_MINY 130
#define TS_MAXX 3800
#define TS_MAXY 4000

#define STMPE_CS 8
Adafruit_STMPE610 ts = Adafruit_STMPE610(STMPE_CS);
#define TFT_CS 10
#define TFT_DC 9
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);

boolean RecordOn = false;

#define FRAME_X 10
#define FRAME_Y 10
#define FRAME_W 50
#define FRAME_H 50

#define FRAME2_X 10
#define FRAME2_Y 70
#define FRAME2_W 50
#define FRAME2_H 50


#define SINGLEBUTTON_X FRAME_X
#define SINGLEBUTTON_Y FRAME_Y
#define SINGLEBUTTON_W FRAME_W
#define SINGLEBUTTON_H FRAME_H

#define SING2BUTTON_X FRAME_X
#define SING2BUTTON_Y FRAME_Y
#define SING2BUTTON_W FRAME_W
#define SING2BUTTON_H FRAME_H

#define DBL_X FRAME2_X
#define DBL_Y FRAME2_Y
#define DBL_W FRAME2_W
#define DBL_H FRAME2_H

#define DBL2_X FRAME2_X
#define DBL2_Y FRAME2_Y
#define DBL2_W FRAME2_W
#define DBL2_H FRAME2_H

void drawFrame()
{
  tft.drawRect(FRAME_X, FRAME_Y, FRAME_W, FRAME_H, ILI9341_WHITE);
  tft.drawRect(FRAME2_X, FRAME2_Y, FRAME2_W, FRAME2_H, ILI9341_WHITE);
}

void singleBtn()
{
  tft.fillRect(SINGLEBUTTON_X, SINGLEBUTTON_Y, SINGLEBUTTON_W, SINGLEBUTTON_H, ILI9341_RED);
  tft.fillRect(SING2BUTTON_X, SING2BUTTON_Y, SING2BUTTON_W, SING2BUTTON_H, ILI9341_GREEN);
  drawFrame();
  tft.setCursor(SING2BUTTON_X + 75 , SING2BUTTON_Y + (SING2BUTTON_H / 2));
  tft.setTextColor(ILI9341_WHITE);
  tft.setTextSize(2);
  tft.println("1 INCH & BUTTON");
  RecordOn = false;
}

void sing2Btn()
{
  tft.fillRect(SING2BUTTON_X, SING2BUTTON_Y, SING2BUTTON_W, SING2BUTTON_H, ILI9341_GREEN);
  tft.fillRect(SINGLEBUTTON_X, SINGLEBUTTON_Y, SINGLEBUTTON_W, SINGLEBUTTON_H, ILI9341_RED);
  drawFrame();
  tft.setCursor(SINGLEBUTTON_X + 75 , SINGLEBUTTON_Y + (SINGLEBUTTON_H / 2));
  tft.setTextColor(ILI9341_WHITE);
  tft.setTextSize(2);
  tft.println("1 INCH & BUTTON");
  RecordOn = true;
}

void dblBtn()
{
  tft.fillRect(DBL_X, DBL_Y, DBL_W, DBL_H, ILI9341_GREEN);
  tft.fillRect(DBL2_X, DBL2_Y, DBL2_W, DBL2_H, ILI9341_RED);
  drawFrame();
  tft.setCursor(DBL2_X + 75 , DBL2_Y + (DBL2_H / 2));
  tft.setTextColor(ILI9341_WHITE);
  tft.setTextSize(2);
  tft.println("DOUBLE W/ BUTTON");
  RecordOn = false;
}

void dbl2Btn()
{
  tft.fillRect(DBL2_X, DBL2_Y, DBL2_W, DBL2_H, ILI9341_RED);
  tft.fillRect(DBL_X, DBL_Y, DBL_W, DBL_H, ILI9341_GREEN);
  drawFrame();
  tft.setCursor(DBL_X + 75 , DBL_Y + (DBL_H / 2));
  tft.setTextColor(ILI9341_WHITE);
  tft.setTextSize(2);
  tft.println("DOUBLE W/ BUTTON");
  RecordOn = true;
}

void setup(void)
{
  pinMode(button, INPUT_PULLUP);
  pinMode(gluemac, OUTPUT);
  digitalWrite(gluemac, HIGH);       //relay is active low

  myStepper1.setSpeed(3000);  //  table slide

  myStepper2.setSpeed(300);   //substrate rotate

  Serial.begin(9600);
  tft.begin();
  if (!ts.begin()) {
    Serial.println("Unable to start touchscreen.");
  }
  else {
    Serial.println("Touchscreen started.");
  }

  tft.fillScreen(ILI9341_BLACK);
  // origin = left,top landscape (USB left upper)
  tft.setRotation(1);
  singleBtn();
  dblBtn();

}

void loop()
{
  // See if there's any  touch data for us
  if (!ts.bufferEmpty())
  {
    // Retrieve a point
    TS_Point p = ts.getPoint();
    // Scale using the calibration #'s
    // and rotate coordinate system
    p.x = map(p.x, TS_MINY, TS_MAXY, 0, tft.height());
    p.y = map(p.y, TS_MINX, TS_MAXX, 0, tft.width());
    int y = tft.height() - p.x;
    int x = p.y;

     if (RecordOn)
       {
         if ((x > SINGLEBUTTON_X) && (x < (SINGLEBUTTON_X + SINGLEBUTTON_W))) {
           if ((y > SINGLEBUTTON_Y) && (y <= (SINGLEBUTTON_Y + SINGLEBUTTON_H))) {
             Serial.println("SINGLE ONe");
             singleBtn();
             single();
           }
         }
       }
       else //Record is off (RecordOn == false)
       {
         if ((x > SING2BUTTON_X) && (x < (SING2BUTTON_X + SING2BUTTON_W))) {
           if ((y > SING2BUTTON_Y) && (y <= (SING2BUTTON_Y + SING2BUTTON_H))) {
            delay(15);
             Serial.println("SINGLE two");
             sing2Btn();
           }
         }
       }
    if (RecordOn)
    {
      if ((x > DBL_X) && (x < (DBL_X + DBL_W))) {
        if ((y > DBL_Y) && (y <= (DBL_Y + DBL_H))) {
          delay(15);
          Serial.println("DOUBLE ON");
          dblBtn();
          dblros();
        }
      }
    }
    else //Record is off (RecordOn == false)
    {
      if ((x > DBL2_X) && (x < (DBL2_X + DBL2_W))) {
        if ((y > DBL2_Y) && (y <= (DBL2_Y + DBL2_H))) {
          Serial.println("DOUBLE OFF");
          dbl2Btn();
        }
      }
    }
    Serial.println(RecordOn);
  }
}

void single()
  {
  val = digitalRead(button);    //read input value and store it

  if ((val == LOW) && (old_val == HIGH)) {     //check if there was a transition
    state = 1 - state;
    delay(15);      //button debounce
  }

  old_val = val;          //store old value
  if (state == 1) {

    myStepper1.step(6000);           //slide table in
    Serial.println("clockwise");

    delay(25);
    digitalWrite(gluemac, LOW);      //turn glue machine on
    Serial.println("relay_on");
    delay(300);

    myStepper2.step(1600);           //rotate 1 time
    Serial.println("rotate");

    digitalWrite(gluemac, HIGH);       //turn glue off
    Serial.println("relayoff");
    delay(500);

    myStepper1.step(-6000);             // slide table out
    Serial.println("counterclockwise");

    state = 0;                           //turn everything off

  }
  }

void dblros()
{
  val = digitalRead(button);    //read input value and store it

  if ((val == LOW) && (old_val == HIGH)) {     //check if there was a transition
    state = 1 - state;
    delay(15);      //button debounce
  }

  old_val = val;          //store old value
  if (state == 1) {

    myStepper1.step(6000);           //slide table in
    Serial.println("clockwise");

    delay(25);
    digitalWrite(gluemac, LOW);      //turn glue machine on
    Serial.println("relay_on");
    delay(300);

    myStepper2.step(1600);           //rotate 1 time
    Serial.println("rotate");

    digitalWrite(gluemac, HIGH);       //turn glue off
    Serial.println("relayoff");
    delay(500);

    myStepper1.step(-6000);             // slide table out
    Serial.println("counterclockwise");
    delay(1000);

    myStepper1.step(6400);             // slide table in
    Serial.println("clockwise");

    delay(25);
    digitalWrite(gluemac, LOW);      //turn glue machine on
    Serial.println("relay_on");
    delay(300);

    myStepper2.step(1600);           //rotate 1 time
    Serial.println("rotate");

    digitalWrite(gluemac, HIGH);       //turn glue off
    Serial.println("relayoff");
    delay(500);

    myStepper1.step(-6400);             // slide table out
    Serial.println("counterclockwise");

    state = 0;                           //turn everything off

  }
}
 singleBtn();
             void single();
           }

I don't think that is your problem, but that "void" should not be there.
Please post the actual error message.

It's also polite to remove any commented-out code before posting.

AWOL this is the message;

onoffbutton:251: error: expected unqualified-id before ')' token
void double()
^
exit status 1
expected primary-expression before 'void'

I left the commented code because that is what I started with and it compiles and works but when I added the second button and had problems I commented it out to see if that was the problem but it still gave me the error.

I want the void double(); code to be in effect when that dblBtn button is pushed.

'double' is a type, you can't use types as function names.

Moderator edit: The obvious :wink:

Thanks MarkT, didn't know that.

I have updated my code on my original post with the suggestions provided but the display and function of the virtual buttons works properly I can't seem to make the rest of the code operate.

I know the code for the steppers works as I currently use it now but I'm trying to marry the TFT with the stepper code and see I haven't done something right to make the TFT pass off to run stepper code.

Can anyone send me in the proper direction?

Thanks.