uguryazici:
My code has more than 9k chars so i couldn't upload whole code.
:o
How did you manage to write 9k of code riddled with compiler errors? Did you just sit down and type it all out without even checking once to see if it compiled? Imagine a carpenter or welder who just cuts out all the wood or metal, starts assembling, and doesn't once use a measure or square during the build and just assumes that it will all be ok!
When we write code, we build sections that do stuff and then we test that the stuff we just wrote does what we think it should do. You put in tests as you go - on Arduino, this means sticking some LEDs in and confirming that they flash when you think they should. Think in terms of components - the motor start and stopper, the pending-button-light handler. Once a component is written and tested, then go onto the next bit. You don't just chunder out 9k of C++ without so much as compiling it even once and just and expect it to go.
The other issue, of course, is that you don't need that much code to make an elevator go up and down. From the tiny snippets you have posted so far, it's clear you don't understand (for instance) arrays, which really are a pretty key thing.
Perhaps you should start on something smaller. Why not make an elevator controller with just two stations, two call buttons, a motor and a 'door open' sensor?
-- EDIT --
Ok, 9k of code really isn't that much. And you really need a shift register for the LEDs rather than consuming 8 output pins each.
So, your motor takes exactly 100ms to get from one floor to the next?
I also can't help noticing that you never actually stop the elevator once it reaches the correct floor. It will just keep going.
Look, here's your first project: write a pair of functions that display a digit in your two seven-segment displays. Then find out about passing arrays to functions and re-write them so that theres jus one function that accepts an array of pin numbers and a digit to be displayed. Then re-write it so that instead of a bunch of if() statments to display the digits, the pattern for the digits is stored in a 2-dimensional array. Then, for bonus points, instead of using an array to hold the digit patterns, put them in a bitfield.
Then go purchase a pair of serial-in/parallel-out shift registers (they are 5 bucks) and discover how to use them to drive a 7-segment display.
And at that stage, you will have displaying a digit in a 7-segment display down and it might be time to start thinking about coding up an elevator controller.
(ps: Oh - did you accidentally purchase the othr kind of shift register? Don't throw it out! You use that one for the buttons.)