the hall effects need to be read at the beginning of the loop otherwise it wouldn't stop at the right floor(at least with the way I wrote it).
You are reading the hall effect sensors blindfolded. Since you don't care what state they are in, nothing is accomplished by reading them.
If you think that something IS, there is something wrong with your hardware or program logic.
As for the floor1function it sounds good to me I don't really see what the complaint is.
The Arduino team could have supplied functions like readFunction1(), readFunction2(), writeFunction1(), writeFunction2(), etc. Then, you'd need a cheat sheet to know which function to call to read a digital pin, or to write to a PWM pin. Instead, they use names that (mostly) make sense.
Does floor1function() cause the elevator to go up or down? The names does not mean a thing, except to you. If anyone else were to use it, you'd need to supply a cheat sheet.
If the function were called upToFloorOne() or downToFloorOne(), anyone could figure out which function to call to go from where the were to where they wanted to be.
The other problem with the names is, of course, that you don't need so many functions. Using my naming convention, you'd need functions upToFloor(n) and downToFloor(n). Then, you'd probably want to create a function, changeLevel(currFloor, destFloor); that would take you from one floor to another. It would figure out whether you needed to go up or down.
Finally, I'm relatively certain that that is what your instructor expects you to figure out.
Finally the hall effects are not told to be in any position. I have a magnet attached to my platform and it is low when the platform is there and high when it is not. So in my head it made sense to say while the hall effect is not seeing a magnetic field run the motor in the direction it needs to go.
In MY mind, it makes more sense to tell the motor to go some direction, and then watch for the appropriate state change to happen. Once you've spurred the horse, and it's started running, there is nothing gained by kicking it again and again. While the pins don't mind, it is not necessary.
motordown();
while (digitalRead(halleffect1) == HIGH)
{
// Don't need to do anything until we get to the right floor.
}
Apparently I wrong to get excited to see it run and post the code without commenting what was going on with.
No, you weren't. I get excited when my code works, too, and like to show it off.
I simply saw some useless code, and some opportunities for improvement. When someone points out stuff in my code that could be improved, I make a copy, and try out there suggestions.