

To set a motor equal to the value of a joystick, one would type something like: motor = vexRT Partner Joystick Note that button groups 5 & 6 only have U and D. vexRT to get the 0/1 value from button group 6, top ( Up) button possible values Btn5–Btn8, and either U ( Up), D ( Down), L ( Left), or R ( Right).vexRT, for getting the 127 to -127 value from the position of joystick channel 2 possible values Ch1 – Ch4.Channels and buttons (the only 2 options on the joystick) are referenced in the format: To set a motor to a fixed power level, one would type something like: motor = 100 īut how about connecting it to the joystick? In RobotC, controller buttons and joysticks start with the reference vexRT - VEX Remote Transmitter. In RobotC, you must type this stuff in yourself. In eas圜, if you want to turn on a motor, you drag over a motor block, tell the popup window which one you’re using, and give it a power level. In the setup window, you simply put some descriptive name, like “rightFront” into the setup window, and from that point on, you can just reference it by that name. In the motors & sensors setup window, you can give each motor a name (recommended) in lieu of having to remember that the right-front motor is plugged into, say, port 7.
#Robotc how to program code#
You don’t have to comment every line of code, but you do have to comment every block of code if the following 6 lines of code together accomplish ABC, there needs to be a comment at the top of those 6 lines explaining what’s happening in the following section, and anything special or unusual about why it’s written the way it is. So then YOU’RE going to waste a lot of time trying to reconstruct your own thought process to figure out WHAT THE HECK YOU DID. Do you think you’re going to remember what that nifty, complex section of code does, exactly? Or why you had to do ABC in a sort-of convoluted way? HAH! No, you’re not. Now in January you’re getting ready for States and you see that your code needs to be modified. Imagine this: you figure out how to do something really cool and complicated in your code during the summer, and your team goes along happily most of the year using that nifty code. Really, you are doing YOURSELF a huge favor by putting comments in your code.

This week, I learned how to program a joystick to drive a chassis. I will post things here as I learn them, that might be helpful to others who are also new to this language. This post is part of my journey from eas圜 to RobotC.
