Program (nxt)
The installation and maintenance technicians need a program to calibrate and test the mechanical oper- ation of an elevator.
Write the program that takes theElevator-NXTthrough a calibration and test sequence, as shown in thisvideo.
To calibrate the elevator:
1.Raise the car as far as it goes to the top (the top floor).
2.Reset the rotation sensor.
3. Lower the car to the bottom (the bottom floor).
4. Record the rotation value. This value can be used to calculate the amount of rotation required to get to the middle two floors.
To test the elevator, make it go to floors 2, 3, 1, and 0 in that order. At each floor open the doors, wait for 1.5 seconds, and close the doors.
Hints:
• Use time to control how long the motor runs when opening and closing the doors.
• This problem is much easier to write if you make good use of procedures. Write a procedure for every basic action the elevator performs.
• The robot does not have to do more than one thing at a time. Threads are not necessary.