![pltw robotc pltw robotc](https://i.ytimg.com/vi/-cF0rPdI5KI/maxresdefault.jpg)
I do not know if it was a requirement for you. It does not store up and down call while it is moving and go there later.
#PLTW ROBOTC CODE#
Note : in this code the elevator will only take care of new up and down floor calls when the elevator is idle. we check if we trigger a floor switch and stop the elevator
![pltw robotc pltw robotc](http://lukespltwportfolio.weebly.com/uploads/9/0/5/5/90550635/image1.png)
we check if a button is pressed and possibly go up or down Now, if we translate this into some pseudo code (which should be easily translated to RobotC) : enum elevator_status = The elevator is at a given floor and go from one floor to the other when it trigger a switch: Let's define what are the states of an elevator at a given moment: If (calldown = 1 & floorat = 1 & calldown = 0 || calldown = 1 & floorat = 1)Īlthough it shouldn't be a concern for this question, the 60 in the startMotor command is the speed of the motor, just to make it clearer. If (callup = 1 & floorat = 1 & calldown = 0 || callup = 1 & floorat = 1 & callup = 0) If (SensorValue = 1 & floorat = 1)Įlse if (callup = 1 & floorat = 1) When the shaft sticking out the motor mechanism moves up and down, it presses limit switches and causes it to return a value of 1. The motor (mainMotor) rotates the gear which causes the mechanism to travel upwards on the slide. ) are analog buttons and return a value of 0 if not pressed and 1 if pressed. Could I possibly do anything to make this any simpler? Or better? I have attached a picture of my design that I made in AutoCAD Inventor with labels.įor those not familiar with RobotC or VEX (it is VERY similar to C and C++): the limit switches (limit1, limit2.
![pltw robotc pltw robotc](http://carrolltonrobotics.weebly.com/uploads/2/4/9/2/24928662/3458612.jpg)
I'm designing and programming an elevator-like robot for a high school project.