problem with my own funktions

Hello,
i want to write my own Funktion to make my skatch Shorter.
But every time i try to uplode it in my arduino the Software says that the fuktion "was not declared in this scope". What is wrong with my sketch ? (sorry, some parts are in german )

#define DELAY0 10000 // Pause 0, 10 Sekunden
#define DELAY1 1000 // Pause 1, 1 Sekunde
#define DELAY2 2000 // Pause 2, 2 Sekunden
#define DELAY3 3000 // Pause 3, 3 Sekunden
int ledPinRotAuto = 7; // Pin 7 steuert rote LED (Autoampel)
int ledPinGelbAuto = 6; // Pin 6 steuert gelbe LED (Autoampel)
int ledPinGruenAuto = 5; // Pin 6 steuert grüne LED (Autoampel)
int ledPinRotFuss = 3; // Pin 3 steuert rote LED (Fußgängerampel)
int ledPinGruenFuss = 2; // Pin 2 steuert grüne LED (Fußgängerampel)
int tasterPinAmpel = 8; // Ampeltaster wird an Pin 8 angeschlossen
int tasterAmpelWert = LOW; // Variable für den Status des Ampeltasters

void setup(){
pinMode(ledPinRotAuto, OUTPUT);
pinMode(ledPinGelbAuto, OUTPUT);
pinMode(ledPinGruenAuto, OUTPUT);
pinMode(ledPinRotFuss, OUTPUT);
pinMode(ledPinGruenFuss, OUTPUT);
pinMode(tasterPinAmpel, INPUT);
digitalWrite(ledPinGruenAuto, HIGH);
digitalWrite(ledPinRotFuss, HIGH);
}

void loop(){

tasterAmpelWert = digitalRead(tasterPinAmpel);

if(tasterAmpelWert == HIGH)
ampelUmschaltung();
}

void ampelUmschaltung(){
digitalWrite(ledPinGruenAuto, LOW);
digitalWrite(ledPinGelbAuto, HIGH); delay(DELAY3);
digitalWrite(ledPinGelbAuto, LOW);
digitalWrite(ledPinRotAuto, HIGH); delay(DELAY1);
digitalWrite(ledPinRotFuss, LOW);
digitalWrite(ledPinGruenFuss, HIGH); delay(DELAY0);
digitalWrite(ledPinGruenFuss, LOW);
digitalWrite(ledPinRotFuss, HIGH); delay(DELAY1);
digitalWrite(ledPinGelbAuto, HIGH); delay(DELAY2);
digitalWrite(ledPinRotAuto, LOW);
digitalWrite(ledPinGelbAuto, LOW);
digitalWrite(ledPinGruenAuto, HIGH);
}

The code that you posted compiles OK for me. Did you post the correct code ?

What is the full error message that you get ?

Arduino: 1.6.13 (Windows 10), Board: "Arduino/Genuino Uno"

In function 'void loop()':

Ampel:29: error: 'ampelUmschaltung' was not declared in this scope

: In function 'void ampelUmschaltung()':

Ampel:33: error: 'ledPinGlebAuto' was not declared in this scope

Ampel:34: error: 'ledPinGeldAuto' was not declared in this scope

exit status 1
'ampelUmschaltung' was not declared in this scope

this is the errorcode :frowning: i dont have an idear what is wrong with my Sketch.

Are you sure that the program that you posted is the one that causes the errors ?

Ampel:33: error: ‘ledPinGlebAuto’ was not declared in this scope

Ampel:34: error: ‘ledPinGeldAuto’ was not declared in this scope

Obviously, you have SPELLING ERRORS in the code you are attempting to compile.

Arduino: 1.6.13 (Windows 10), Board: “Arduino/Genuino Uno”

In function ‘void loop()’:

Ampel:29: error: ‘ampelUmschaltung’ was not declared in this scope

exit status 1
‘ampelUmschaltung’ was not declared in this scope

now without the spellingmistakes

now without the spellingmistakes

Please post your code as it is now.

#define DELAY0 10000
#define DELAY1 1000
#define DELAY2 2000
#define DELAY3 3000

int ledPinRotAuto = 7;
int ledPinGelbAuto = 6;
int ledPinGruenAuto = 5;
int ledPinRotFuss = 3;
int ledPinGruenFuss = 2;
int tasterPinAmpel = 8;
int tasterAmpelWert = LOW;

void setup(){
pinMode(ledPinRotAuto, OUTPUT);
pinMode(ledPinGelbAuto, OUTPUT);
pinMode(ledPinGruenAuto, OUTPUT);
pinMode(ledPinRotFuss, OUTPUT);
pinMode(ledPinGruenFuss, OUTPUT);
pinMode(tasterPinAmpel, INPUT);
digitalWrite(ledPinGruenAuto, HIGH);
digitalWrite(ledPinRotFuss, HIGH);

}

void loop(){
tasterAmpelWert = digitalRead(tasterPinAmpel);
if(tasterAmpelWert == HIGH)
ampelUmschaltung();
}
void ampelUmschaltung(){
digitalWrite(ledPinGruenAuto, LOW);
digitalWrite(ledPinGelbAuto, HIGH); delay(DELAY3);
digitalWrite(ledPinGelbAuto, LOW);
digitalWrite(ledPinRotAuto, HIGH); delay(DELAY1);
digitalWrite(ledPinRotFuss, LOW);
digitalWrite(ledPinGruenFuss, HIGH); delay(DELAY0);
digitalWrite(ledPinGruenFuss, LOW);
digitalWrite(ledPinRotFuss, HIGH); delay(DELAY1);
digitalWrite(ledPinGelbAuto, HIGH); delay(DELAY2);
digitalWrite(ledPinRotAuto, LOW);
digitalWrite(ledPinGelbAuto, LOW);
digitalWrite(ledPinGruenAuto, HIGH);
}

this is the code

That compiles for me okay in IDE 1.6.9 for the Uno.

The original post compiled okay too tho.

But in 1.6.13 it compiles wrong. do you have an idear how i can solve this Problem ?

No, it compiles just fine in 1.6.13.

I notice the "void" of your function ampelUmschaltung() doesn't line up with the v in the void of the other two functions. Perhaps you have an accidental invisible character in there that we don't have in our copy from the web. Try deleting the last line of loop() and the first line of ampelUmschaltung() and retyping them.

My skatch is already too short :frowning:

outsider:
My skatch is already too short :frowning:

Urban dictionary is not even helping me out with that one outsider.

but the Problem is that this is not the first time that i get an error if i trie to use own fuktions. I got an error every time. Is it possible that i installed1.6.13 wrong or something like this. because i retyped the parts @ChrisTenone told me, but the Problem is still there :frowning:

If you suspect having installed the IDE not properly, why don't you just de-install the previous installation and re-install. then see what happens and if your issue still remains or not.

As the previous posters don't have problems to compile the sketch, before de-installing:
Open a new sketch, then copy your own latest code from here and paste it into your new sketch window.

If that doesn't help, the last try would be to move your function as the first section of your code. Still problems -> Re-install.

Try this

void setup()
{
  Serial.begin(115200);
  char * aCharVariable = "This is from a variable";
  myOwnFunction("Some text");
  myOwnFunction(aCharVariable);
}

void loop() {}

void myOwnFunction(char * message)
{
  Serial.println(message);
}

Does it work ?