Switch case?

Hallo, wie mache ich einen Swtich case mit dem Arduino Uno?

Bei meinem normalen Mikrocontroller (Programmiersprache c)

machte ich einen enum{Name1,Name2,...}state=Name1;

dann einfach

Switch(state)

{

case Name1: und so weiter

Wie geht es hier beim Arduino?

Was bedeutet num = random(int(3));?? Hat das etwas mit dem zu tun?

MFG :)

An example :

enum {Name1, Name2} state = Name1;

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

void loop()
{
  switch (state)
  {
    case Name1:
      Serial.println("Current case is Name1");
      Serial.println(random(3));
      delay(2000);
      state = Name2;
      break;
    case Name2:
      Serial.println("Current case is Name2");
      Serial.println(random(3));
      delay(2000);
      state = Name1;
      break;
  }
}

num = random (int (3));Returns a pseudo random number between 0 and 2

Thanks, so i can use it like the usual C?

Bc some Variables are like : digitalWrite i have never used them before

Do you have any tasks for me to learn that?

Thank you :)

ArduinoGUIDE: Bc some Variables are like : digitalWrite i have never used them before

Do you have any tasks for me to learn that?

digitalWrite()'s not a variable, it's a function.

All are explained in these tutorials and the reference.

so i can use it like the usual C?

Not just like C, it is C.

Actually it is C++