06|09 Mehrere Rückgabewerte in Abhängigkeit

###

 

Spezifikationen
- Signalart: digital
- Spannung: 3,3V – 5V
- Pinabstand: 2,54mm

const int potiPin = A0;


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


void loop() 
{
  int potiValue = analogRead(potiPin);

  
  
  if(exFunction(potiValue))
  {
    Serial.println("if-Körper wird ausgeführt!");
  } 
 
  Serial.print("LOOP:                 ");
  Serial.println(potiValue);
  Serial.println();
  delay(1000); 
}


bool exFunction(int testValue)
{
  if (testValue > 512) 
  {  
    Serial.println("Externe Funktion: Über 512");
    return true;
  }
  
  if (testValue < 512) 
  {
    Serial.println("Externe Funktion: Unter 512");
    return false;
  }

  Serial.println("Ende");
}