kasceswiss.blogg.se

Robotc code examples
Robotc code examples







robotc code examples

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. Your robot should move forward.I'm designing and programming an elevator-like robot for a high school project. Press the Play Button (labeled #3) and you should see a VEX IQ Field with 3 green cubes and a Clawbot robot.Ĭhange the view to Camera 2 and Hit Play.

robotc code examples robotc code examples

That the Training Table is Basic Movement 1 (do this by clicking the Training Circle, also labeled #2).We want to log in locally as a Guest (for now):įrom the Home Screen we need to verify a two things:

#Robotc code examples download#

Hint: If you look at the highlighted menu item, on the right you’ll see F5, that’s the Keyboard Shortcut for Compile and Download Program.Īfter the program compiles it will bring up the Robot Virtual Worlds login window.

  • Choosing the Robot menu item, then choosing Compile and Download Program.
  • Like many things, there are at least two ways you can compile and download the program to the virtual robot: For students, this would be in your student directory under your Teacher’s directory (or folder). Select Save As… and choose a place to save the file. Hint: the two “thumb tacks” I’m pointing to in the screenshot will “un-pin” the panels and let them autohide to give you more space in the editor.Īt this point we need to save our program somewhere else so ROBOTC doesn’t complain we’re trying to overwrite the sample program. So we should be able to Compile, Download and Run the program.
  • Single click on the file Moving Forward.c and then clicking OpenĪt this point you should see Moving Forward.c in the main code window in the ROBOTC IDE.
  • Double click on the file Moving Forward.c.
  • Next, inside the File Open Dialog double click on Basic Movements Next we’re going to run a sample program to make sure we have everything set up correctly.įirst, go to the File menu and select Open Sample Program Note: If you don’t see Select Virtual Worlds to Use or Open RVW Level Builder Utility under the Window menu item then you probably haven’t chosen Virtual Worlds as the compiler target, go back to Step 2. Now that we’ve set the Compiler Target to Robot Virtual Worlds we can chooose the correct World for our purposes: You’ll know you have that correct when the dot is next to Virtual Worlds. Set the compiler target to Virtual Worlds: Not Graphical and not Robot Virtual Worlds: To bring up the ROBOTC IDE find and double click on the ROBOTC for VEX Robotics shortcut.
  • Run a sample program to make sure everything works.
  • robotc code examples

    Set the Compiler Target to Robot Virtual Worlds.There’s a few steps we need to take care of: We’re going to be doing all of our programming inside the ROBOTC IDE and running are programs on virtual robots inside Robot Virtual Worlds. Chapter 1 - Getting Started Getting Started









    Robotc code examples