after saftey code how to go to next loop ?

Hello,
I have a project here for making a tri drone go up and down with pwm but for saftey i will first start the programme with a code.
How can i fixe this ?

ps.(sorry for my english i'm from Belgium :D)

#include <Password.h>

Password password = Password( "0204" );
byte currentLength = 0;
int input = 0;

void setup() {              
  // initialize the PWM pin as an output.
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);

  Serial.begin(9600);
  Serial.println("Try to guess the password!");
  Serial.println("Reset with - evaluate with +");
  Serial.print("Enter password: ");
}

void loop() {

  Code();
  Move();
}

void Move()
{
  if (Serial.available()){
    int input = Serial.read();
    if (input == '0'){
      analogWrite(11, 140);
      analogWrite(10, 130);
      analogWrite(9, 140);

      Serial.println("Speed is at 55%");
    }  
    if (input == '1'){
      analogWrite(11, 153);
      analogWrite(10, 143);
      analogWrite(9, 153);
      Serial.println("Speed is at 60%");
    }
    if (input == '2'){
      analogWrite(11, 166);
      analogWrite(10, 156);
      analogWrite(9, 166);
      Serial.println("Speed is at 65%");
    }

    if (input == '3'){
      analogWrite(11, 179);
      analogWrite(10, 179);
      analogWrite(9, 179);
      Serial.println("Speed is at 70%");
    }
    if (input == '4'){
      analogWrite(11, 191);
      analogWrite(10, 191);
      analogWrite(9, 191);
      Serial.println("Speed is at 75%");
    }
    if (input == '5'){
      analogWrite(11, 204);
      analogWrite(10, 204);
      analogWrite(9, 204);
      Serial.println("Speed is at 80%");
    }
    if (input == '6'){
      analogWrite(11, 217);
      analogWrite(10, 217);
      analogWrite(9, 217);
      Serial.println("Speed is at 85%");
    }
    if (input == '7'){
      analogWrite(11, 230);
      analogWrite(10, 230);
      analogWrite(9, 230);
      Serial.println("Speed is at 90%");
    }

    if (input == '8'){
      analogWrite(11, 242);
      analogWrite(10, 242);
      analogWrite(9, 242);
      Serial.println("Speed is at 95%");
    }
    if (input == '9'){
      analogWrite(11,255);
      analogWrite(10,255);
      analogWrite(9,255);
      Serial.println("Speed is at 100%");
    }

  }
}


void Code()
{
  if (Serial.available()){
    char code = Serial.read();
    switch (code){
    case '-': //reset password
      password.reset();
      currentLength = 0;
      Serial.println("\tPassword is reset!");
      break;
    case '+': //evaluate password
      if (password.evaluate()){

        Serial.println("\tYou guessed the correct password!");
      }
      else{
        Serial.println("\tYou did not guess the correct password!");

      }
      break;
    default: //append any keypress that is not a '-' nor a '0' to the currently guessed password.
      password.append(code);
      currentLength++;

      //Print some feedback.
      Serial.print("Enter password: ");
      for (byte i=0; i<currentLength; i++){
        Serial.print('*');
      }
      Serial.println();
    }
  }
}

Surely you want the password to be entered before loop is called?
Put the password code in setup.

Nope i't don't work :frowning:

OK, thanks for letting us know.
Good luck.

MichielRoux:
Nope i't don't work :frowning:

That is because you did not move it correctly.