Argon - having trouble with false button presses

I’ve put this post in here because it’s one of the very first projects we should be doing with our Particles, but I’d appreciate if someone more knowledgeable can check my code and explain why I’m randmonly getting false button presses.
My setup is an argon, powered by USB on an Adafruit tripler board with an xbee, having just 3.3v, GND, and TX pins connected to the xbee.
I have a terminal block connected to GND and A1. This is where I’ve connected the pushbutton.
The purpose of this setup is to use as a remote trigger for a loading dock warning system, which obviously is hopeless if it keeps random button pressing!

/*  Simple sketch which takes a momentary push button as input then sends command to Xbee via uart.  A receiving device with Xbee will then respond accordingly.

// Global variables
int led = 7; // Use the onboard blue LED
int pushButton = A1;  // pushbutton is connected to A1
int reading;
int previous = HIGH;
unsigned long timeOfPress = 0;
unsigned long debounce = 200;
bool buttonPressed = 0;
bool goodPress = 0;

void setup() {
    pinMode(led, OUTPUT);  // Initialise D7 pin as output
    pinMode(pushButton, INPUT_PULLUP);  // Initialise A1 pin as input with internal pullup resistor

void loop() {
    int reading = digitalRead(pushButton);
    if ((reading == LOW) && (previous == HIGH)){
        timeOfPress = millis();
        previous = LOW;
    if ((millis() - timeOfPress > debounce) && (reading == LOW) && (previous == LOW)){
            digitalWrite(led, HIGH);
            previous = LOW;
            reading = digitalRead(pushButton);
            goodPress = 1;
    if ((goodPress) && (reading == HIGH) && (previous == LOW)){
                digitalWrite(led, LOW);
                buttonPressed = 1;
                previous = HIGH;
                goodPress = 0;

    if (buttonPressed){
          Serial.println("Button Released");
        buttonPressed = 0;
        digitalWrite(led, LOW);

Your debounce code looks ok, I have not tested it yet.

How long is the wire going to your button? Is it shielded?

More trouble shooting and we were able to find the issue. The pushbutton is one of those big mushroom head ones, with about 500mm of wire connecting it to the particle. We found that when we disconnected the button the false presses completely stopped. So with this knowledge we put a capacitor across the terminals on the button (I think it was a 1uF from memory, just whatever we had on hand) and viola, problem resolved.