elevator programming with atmega16

Thread Starter

mah

Joined Mar 15, 2010
393
The data structure has been discussed in posts 2,3,5&7. Are you asking how or when to modify them?

By the way, are there any other variables you might need? Like what the elevator is doing?
i want to know how to write it in a code and will i use it in this state machine or i will use another code ? . and this is all the variable s that i need for now , if there is any thin came up i will modify it.
 

ErnieM

Joined Apr 24, 2011
8,377
I assume the proximity sensors will tell the car to slow when approaching a floor it needs to stop on.

What tells it when to stop?
 

Thread Starter

mah

Joined Mar 15, 2010
393
when it approach the proximity sensor MCU give order to the motor to stop. no problem in this let's pass to the important step -storing requests- then i will modify the design if needed
 

djsfantasi

Joined Apr 11, 2010
9,163
Here is an example, described in words…

If call button for up is pressed on floor n, set the corresponding array entry (the nth element) to 1 in the up array. If the down button is pressed, set the nth element in the down array instead.

The logic is similar but more complex if the individual call buttons are pressed in the elevator.
 

ErnieM

Joined Apr 24, 2011
8,377
Similarly call buttons in the car set the same elements, but the choice of either up array or down array is determined by the floor the car is on.

I hesitate to state this as it is bass ackwards. First comes the specfication, then the design for hardware, then the overall architecture design for software, then the last and final stage is writing some code.
 

djsfantasi

Joined Apr 11, 2010
9,163
Similarly call buttons in the car set the same elements, but the choice of either up array or down array is determined by the floor the car is on.

I hesitate to state this as it is bass ackwards. First comes the specfication, then the design for hardware, then the overall architecture design for software, then the last and final stage is writing some code.
I totally agree. I almost didn't post anything for that reason, but decided to throw the TS a bone.
 

Thread Starter

mah

Joined Mar 15, 2010
393
how to write the code
Here is an example, described in words…

If call button for up is pressed on floor n, set the corresponding array entry (the nth element) to 1 in the up array. If the down button is pressed, set the nth element in the down array instead.

The logic is similar but more complex if the individual call buttons are pressed in the elevator.
i know this but i don't know how to code it and you said you will help with the code .
 

ErnieM

Joined Apr 24, 2011
8,377
Yes we are quite willing to help you with your code. That includes our observations, recommendations, corrections and the like.

It does not now nor will it ever entail writing your code for you.

I imagine you are new to C which is why you picked a particularly tough problem to begin with. Perhaps you should pick a simpler problem and work your way up to the elevator.
 
Top