void setup() {
  int samlagning;
  Serial.begin(9600);
}

void loop() {
  int takkaval;
  takkaval = athugaTakka();
  Serial.println(takkaval);
}

int athugaTakka() {
  if(digitalRead(6) == LOW) {
    return 10;
  }
  if(digitalRead(7) == LOW) {
    return 20;
  }
  if(digitalRead(8) == LOW) {
    return 30;
  }
  if(digitalRead(9) == LOW) {
    return 40;
  }
}