
Re: brand new, channel 5 and 6 help?
It really does depend on what exactly you are trying to accomplish, how your robot is set up, etc, but a very basic if/else if statement should suffice;
You will need to have the code inside of a while loop so it continually checks for the Joystick button presses. If the 6 Up button is pressed, it will turn on the motors in ports 1 and 2 in one direction; if the 6 Down button is pressed it will turn them on the opposite direction; if neither is pressed the motors will be turned off.
As a side note, I suggest configuring the motors in the Motors and Sensors Setup window (reversing motors as necessary) to avoid having to use a negative sign to move a motor 'forward' or 'up'. It will make the code much simpler to implement and read, because (when configured properly) you will be able to use positive values on on the motors to move forward/up and negative values to move backwards/down without having to remember which ones are flipped.
_________________Check out our
Blog! And our
Facebook page!
Need help? Take a look at our
updated help documentation and the
ROBOTC Forums.