
The way I’ve been using it so far is to track data during the execution of a while loop. Since I’ve been using this for like a week, I’m sure I have only scratched the surface of what it’s capable of. RobotC’s datalog feature allows you to track up to 8 pieces of data (variables, sensor values, etc.) as the program executes, with super-easy, one-click exporting to a CSV file and automated, customizable graphs. With eas圜, you’re limited to either making good use of the LCD screen or having your robot tethered to your computer and doing a lot of print-to-screens, which zoom by at a million miles an hour, with data that’s really hard to get into a spreadsheet afterward. So what is the datalog? In short, it’s print-to-screen on steroids in the most helpful way.

The datalog is one of the multitude of benefits I’m experiencing with RobotC over eas圜, which we have used up to this season. Thanks once again to the coaches on the VEX World Coaches Association Facebook group for guiding me along here. 🙂 This week I learned about RobotC’s datalog functionality.
#Vex robotics robotc code#
Would be good to add some comments to your code as well for clarity.When I learn something new, all you readers get to learn it too. You also have a typo at the top when you declare: int callown You can do the same for the following code as well: startMotor(mainMotor, 60) Īlso it seems like the while loop will never end because the value of x never changes. Here I'd write a function like the following: void adjust_sensors( size_t led, size_t level )
This is repeated with slightly different values. So in the large function called motors you have the following set of operations: int x = 1 The following code snippets I would make into separate functions. I'm not familiar with RobotC or VEX, however I've noticed a certain amount of replicated operations that could be made into their own functions. 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. 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 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.

I'm designing and programming an elevator-like robot for a high school project.
