In a pinch you can wire the switch like in your diagram in the original post. Set one pin to output and write it LOW. Set the other to INPUT_PULLUP. When you read the input, the input will be HIGH for a switch that is not pressed and LOW for the pressed switch. Like this, try it,
const byte groundPin = 11;
const byte switchPin = 12;
void setup()
{
Serial.begin(115200);
pinMode(switchPin, INPUT_PULLUP);
pinMode(groundPin, OUTPUT);
digitalWrite(groundPin, LOW);
}
void loop()
{
Serial.println(digitalRead(switchPin));
delay(500);
}
That will be OK. Ground is ground. All of the ground pins are connected together.