#define vp A0  //constant
const byte sw  = 25;  //SW Input pin
const byte LED = 13;  //LED Output pin

void setup() {
  Serial.begin(9600);
  pinMode(sw, INPUT);
  pinMode(LED, OUTPUT);
}

void loop() {
  bool vsw = digitalRead(sw);
  unsigned int VR = analogRead(vp);
  unsigned int y = map(VR, 0, 4095, 0, 10);
  unsigned long ypow = pow(2, y);

  if (y == 1)
    myfunc1();
  else if (y == 2)
    myfunc2(y);
  else if (y == 3)
    myfunc3(y);
  else if (y == 4)
    myfunc4();
  else
    Serial.println("Function not Found!");

  // Serial.println((String)"Value = " + VR);
   Serial.println((String)"2^" + y + "=" + ypow);
  digitalWrite(LED, !vsw);
  delay(1000);
}

void myfunc1() {   //non parameter non return
  digitalWrite(LED, LOW);
  delay(1000);
  digitalWrite(LED, HIGH);
  delay(1000);
  Serial.println((String)"non parameter non return");
}

long myfunc2(unsigned int y1) {  //have parameter have return
  long y2 = 0;
  for (int i = 0; i < y1; i++) {
    y2 = y2 + i;
  }
  Serial.println((String)"have parameter have return");
  return y2;
}

void myfunc3(unsigned int y1) {  //have parameter non return
  unsigned int y2 = 0;
  while (y2 < y1) {
    Serial.println((String)"y2 = " + y2);
    Serial.println((String)"have parameter non return");
    y2++;
  }
  Serial.println((String)"y2 >= y1");
}

long myfunc4() {   //non parameter have return
  digitalWrite(LED, LOW);
  delay(1000);
  digitalWrite(LED, HIGH);
  delay(1000);
  Serial.println("non parameter have return");
  return 1;
}