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.
#ROBOTC JOYSTICK 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.
#ROBOTC JOYSTICK HOW TO#
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. And god forbid there’s a programming emergency at a competition, and none of the team’s programmers are there (or you, if you’re the only programmer) now people who are not experts at programming are going to have to start poking around in your code, changing stuff, and praying.Without comments, the next programmer will waste lots of time (a) figuring out what you did, or (b) assuming your code does X when it really does Y, and adding more code, assuming the stuff that’s there does X.When your team has multiple programmers jumping in and out of the code, comments are vital so that other programmers can understand what you have done and why you’ve done it. When you write some code, and the robot doesn’t do what you’re expecting, having comments placed throughout your program will help you evaluate the code you’ve written - does the code below do what the comment says it should do? There’s really no excuse for not putting comments in your code, whether you’re using eas圜 or RobotC, or any other language on this earth. Adding a floor/ceiling to your calculated motor power.In this post, I go through the following: In RobotC you must program these items yourself. Unlike eas圜, the standard text-based RobotC does not have joystick blocks that one can simply drag and drop and poof! you have arcade drive. 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.