Need Help fast PLZ!

Hello! I have a Problem! I have a Projekt for school. Its an Elevator! I've build IT nur i can't Code well enough to do the Codeing alone!
I need s.o WHO can Look ober my Script and Code ist that way that it wokrs! PLZ! I need the Elevator to Go to a specific Floor when a Button ist pressed!

Need Help realy fast PLZ!

MY code is:

#define k1p 0
#define k2p 1
#define k3p 2
#define k1m 6
#define k2m 7
#define k3m 8
#define mp 11
#define mm 12

void setup()
{
pinMode(k1m, OUTPUT);
pinMode(k2m, OUTPUT);
pinMode(k3m, OUTPUT);
pinMode(mp, OUTPUT);
pinMode(mm, OUTPUT);
pinMode(k1p, INPUT_PULLUP);
pinMode(k2p, INPUT_PULLUP);
pinMode(k3p, INPUT_PULLUP);
}

void loop()
{
if (digitalRead(k1p) == LOW)
{
digitalWrite(k1m, HIGH);
digitalWrite(mp, HIGH);
digitalWrite(mm, LOW);
}
else
{
digitalWrite(k1m, LOW);
if (digitalRead(k3p) == LOW)
{
digitalWrite(k3m, HIGH);
digitalWrite(mm, HIGH);
digitalWrite(mp, LOW);
}
else
{
digitalWrite(k2m, LOW);
digitalWrite(mp, HIGH);
digitalWrite(mm, HIGH);
}
}
if (digitalRead(k2p) == LOW)
{
digitalWrite(k2m, HIGH);
}
else
{
digitalWrite(k2m, LOW);
delay(1000);
digitalWrite(k2m, HIGH);
delay(1000);
}
}

The elevator should move from one floor to another one. There are 3 floors. For each floor there is one button. Look at the photos in third message under this post and you will hopefully know what i mean! Tanks!!

The Photos are also here arduino forum - Google Drive

Start by posting your code and explaining the problems that you are having

It seems likely that your native language is not English. If so, you may be better off asking for this topic to be moved to one of the language specific sections of the forum

Do we have to guess what you think is wrong with the program? Did you test as you wrote the code? At what point did it stop working as you expected?

Paul

Which language section would you like it moved to ?

UKHeliBob:
Which language section would you like it moved to ?

German please!

Done

Although the OP is not speaking in native English, yet he has very well expressed his need. I would like to insist the OP to remain in this English Language Forum from where he can expect maximum interactions.

This is your codes with code tags (</>):

#define k1p 0
#define k2p 1
#define k3p 2
#define k1m 6
#define k2m 7
#define k3m 8
#define mp 11
#define mm 12

void setup()
{
 pinMode(k1m, OUTPUT);
 pinMode(k2m, OUTPUT);
 pinMode(k3m, OUTPUT);
 pinMode(mp, OUTPUT);
 pinMode(mm, OUTPUT);
 pinMode(k1p, INPUT_PULLUP);
 pinMode(k2p, INPUT_PULLUP);
 pinMode(k3p, INPUT_PULLUP);
}

void loop()
{
 if (digitalRead(k1p) == LOW)
 {
   digitalWrite(k1m, HIGH);
   digitalWrite(mp, HIGH);
   digitalWrite(mm, LOW);
 }
 else
 {
   digitalWrite(k1m, LOW);
   if (digitalRead(k3p) == LOW)
   {
     digitalWrite(k3m, HIGH);
     digitalWrite(mm, HIGH);
     digitalWrite(mp, LOW);
   }
   else
   {
     digitalWrite(k2m, LOW);
     digitalWrite(mp, HIGH);
     digitalWrite(mm, HIGH);
   }
 }
 
 if (digitalRead(k2p) == LOW)
 {
   digitalWrite(k2m, HIGH);
 }
 else
 {
   digitalWrite(k2m, LOW);
   delay(1000);
   digitalWrite(k2m, HIGH);
   delay(1000);
 }
}

The codes are compiled without any error. However, if you are using Arduino UNO, then I would like to request you to avoid the use of DPin-0 and DPin-1 as these two pins are used by Serial Monitor and IDE for program debugging and uploading. You are advised to use DPin-4 and DPin-5 in places of DPin-0 and DPin-1 respectively. This is to say:

#define k1p 4   //0
#define k2p 5   //1

GolamMostafa:
This is your codes with code tags (</>):

#define k1p 0

#define k2p 1
#define k3p 2
#define k1m 6
#define k2m 7
#define k3m 8
#define mp 11
#define mm 12

void setup()
{
pinMode(k1m, OUTPUT);
pinMode(k2m, OUTPUT);
pinMode(k3m, OUTPUT);
pinMode(mp, OUTPUT);
pinMode(mm, OUTPUT);
pinMode(k1p, INPUT_PULLUP);
pinMode(k2p, INPUT_PULLUP);
pinMode(k3p, INPUT_PULLUP);
}

void loop()
{
if (digitalRead(k1p) == LOW)
{
  digitalWrite(k1m, HIGH);
  digitalWrite(mp, HIGH);
  digitalWrite(mm, LOW);
}
else
{
  digitalWrite(k1m, LOW);
  if (digitalRead(k3p) == LOW)
  {
    digitalWrite(k3m, HIGH);
    digitalWrite(mm, HIGH);
    digitalWrite(mp, LOW);
  }
  else
  {
    digitalWrite(k2m, LOW);
    digitalWrite(mp, HIGH);
    digitalWrite(mm, HIGH);
  }
}

if (digitalRead(k2p) == LOW)
{
  digitalWrite(k2m, HIGH);
}
else
{
  digitalWrite(k2m, LOW);
  delay(1000);
  digitalWrite(k2m, HIGH);
  delay(1000);
}
}




The codes are compiled without any error. However, if you are using Arduino UNO, then I would like to request you to avoid the use of DPin-0 and DPin-1 as these two pins are used by Serial Monitor and IDE for program debugging and uploading. You are advised to use DPin-4 and DPin-5 in places of DPin-0 and DPin-1 respectively. This is to say:



#define k1p 4  //0
#define k2p 5  //1

its an arduino mega 2560

Hi

Also with the Mega2560 these pins are the serial interface of the USB.
What I miss are comments.
Also the meaning of the abbreviations does not make any
sense.

best regards

THIS IS MY THIRD POST AFTER THE MAIN POST! YOU´LL FIND THE PHOTOS WHEN YOU KLICK ON THE LINK! THE PHOTOS ARE ON MY GOOGLE DRIVE!

https://drive.google.com/drive/folders/1t7jZdaGObDNo_Df7q2B6DBpXENLJpHNP?usp=sharing

Oh

I see - no help needed :slight_smile:

good luck in future

postmaster-ino:
Hi

Also with the Mega2560 these pins are the serial interface of the USB.
What I miss are comments.
Also the meaning of the abbreviations does not make any
sense.

best regards

the abbreviations make sence to me xD

postmaster-ino:
Oh

I see - no help needed :slight_smile:

good luck in future

but it wont move when i press anything. all the parts (cables, buttens, arduino mega 2560, motor and breadboard is totaly fine!

xrRyZe:
the abbreviations make sence to me xD

But not to us.

xrRyZe:
but it wont move when i press anything

Probably don't scream at the people here (by using only capital characters)

Hallo,

soll das etwa bis Montag früh fertig sein?
Die Pinnamen sind dermaßen kryptisch, dass selbst der kurze Sketch nichts davon ersichtlich macht, außer die Taster vielleicht.
Kein einziger Kommentar der Einem helfen könnte.
Keine einzige Info wie der Ablauf sein soll.
Die Bilder hätte man als Anhang verkleinert anhängen können statt verlinken.

Für einen Außenstehenden ist das in etwa so als wenn er das Hausaufgabenheft um die Ohren geschlagen bekommt und einem noch gesagt wird, nun mach mal, hätte ich gern in 2h fertig.

Für dich. Hier gibts Leute die helfen gern, aber nicht mit so einem Threadauftakt.

Einen Tipp gebe ich dir. Die Taster sind katastrophal falsch angeklemmt. Ganz großer Logikfehler.