#include <OneButton.h>      //  http://www.mathertel.de/Arduino/OneButtonLibrary.aspx

const byte alternatePin = A0;
const byte greenButtonPin    =  2;

OneButton alternateButton(alternatePin);
OneButton greenButton(greenButtonPin);

void function1();
void function2();

void (*currentFunction)() = function1;

void function1() {
  Serial.println("In function1");
}

void function2() {
  Serial.println("In function2");
}

void greenButtonPressed() {
  currentFunction();
}

void alternate() {
  static bool callFunction1 = true;

  Serial.println("switching!");
  callFunction1 = !callFunction1;     // wechseln mit der Taste zwischen den beiden Funktionen
  currentFunction = callFunction1 ? function1 : function2;
}

void setup() {
  alternateButton.attachClick(alternate);
  greenButton.attachClick(greenButtonPressed);
  Serial.begin(115200);
}

void loop() {
  alternateButton.tick();
  greenButton.tick();
}