By Willem Scholten Learning Access Institute

Slides:



Advertisements
Similar presentations
Teacher/Mentor Institute Using the Cortex Chuck Powell.
Advertisements

Jason Howard. Agenda I. How to download robotc II. What is tele-op used for? III. How to build a basic tele-op program IV. Getting the robot to drive.
Automation and Robotics
Developed in collaboration with Introduction to Programming.
V EX C OACHES ' T RAINING October 12, Agenda for Today 9 – 10 AM : Tina Reeves and the Engineering Notebook 10 – Noon : Finish Building, Basic Robot.
Autonomy using Encoders Intro to Robotics. Goal Our new task is to navigate a labyrinth. But this time we will NOT use motor commands in conjunction with.
RobotC Programming for LEGO Mindstorms NXT Carnegie Mellon Dacta Lego Timothy Friez Miha Štajdohar SOURCES:
RobotC For Beginners Tyler Lutz and Keaton Bonds DRSS Enterprise.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
Testbed: Exercises.
ROBOTC for VEX Online Professional Development
ROBOTC for VEX On-Site Professional Development
Coding for the FIRST Tech Challenge: RobotC
Available at: – Operate the Tumbler using a Jumper Pin Operate the Tumbler using the jumper pin.
Weston Schreiber & Joshua Gabrielse Robotics Summer Training Programming #1: EasyC Basics.
The New FTC Platform (Connecting your legacy hardware)
Teacher/Mentor Institute Using easyC Joel Kirkland July 30-31, 2015.
Programming Design ROBOTC Software Principles of Engineering
Robot C and Natural Language
Introduction to Vexnet
RobotC Remote Control. Learning Objectives: Focusing on Virtual World with Physical Examples Understand Real-Time Joystick Mapping Understand how to use.
Programming - Motion Intro to Robotics. Motors and Sensors Setup The first thing we need to do is tell ROBOTC that we have motors on our robot. Choose.
Programming your Robot
Automation and Robotics.  First you select the platform type so that you can use Natural Language PLTW.
Vex Robotics program three: using motors and sensors together.
Programming VEX Cortex Robotics with ROBOTC
Testbed Coding In this activity you will code different challenges for the Testbed. For each challenge a sample program is shown. Use what this sample.
Robot C and Natural Language. Create a folder Create a folder on your desktop to insert all your Robot C files, Here you will begin with your template.
Programming Design ROBOTC Software. Behavior-Based Programming A behavior is anything your robot does –Turning on a single motor or servo Three main types.
Robotics Programming Wall Follow Line tracking for a set amount of time Line tracking for a distance.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc. Automation and Robotics VEX.
Robotics Education & Competition Foundation
After Construction Name: Per #:.
Programming Design ROBOTC Software Principles Of Engineering
Introduction to Vexnet
Introduction to Programming in RobotC
Introduction to Programming
ROBOTC for VEX Online Professional Development
ROBOTC for VEX On-Site Professional Development
Robotics Programming Using Shaft Encoders
Automation and Robotics
StarStruck in a Virtual World: Fantasticbot Version
Programming Design ROBOTC Software Computer Integrated Manufacturing
Programming Part 2 Mod Kit
Basics for Robotics Programming
Movement using Shaft Encoders
Getting Started in RobotC
Automation and Robotics
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
Getting Started in RobotC
While Loops and If-Else Structures
Programming Design ROBOTC Software Principles Of Engineering
While Loops and If-Else Structures
While Loops and If-Else Structures
While Loops and If-Else Structures
VEXnet User's Guide.
Programming - Buttons Intro to Robotics.
Automation with RobotC
Robotics Programming Using Shaft Encoders
Programming - Buttons Intro to Robotics.
Robotics Programming Using Shaft Encoders
Remote Control For this activity we will use the Squarebot
While Loops and If-Else Structures
RobotC Programming for LEGO Mindstorms NXT
Automation with RobotC
Robotics Programming Using Shaft Encoders
While Loops and If-Else Structures
Programming Design ROBOTC Software Principles of Engineering
While Loops And If-Else Structures
Introduction to Programing the Cortex for BEST
Presentation transcript:

By Willem Scholten Learning Access Institute RobotC for VEX By Willem Scholten Learning Access Institute

RobotC for VEX Section 1 - RobotC How to switch between VEX 2.0 Cortex and VEX IQ Section 2 - RobotC Firmware Updating Section 3 - Establishing VEXnet Link Section 4 - Paring Remote and Cortex Section 5 - RobotC Examples - basic telex robot Section 6 - RobotC and Basic Drive Bot Section 7 - VEX Robotics - RobotC Competition Template

RobotC How to switch between VEX 2.0 Cortex and VEX IQ By Willem Scholten Learning Access Institute

Goto the Robot menu

Goto the Platform Type

Now select platform: — VEX 2.0 Cortex (For VEX) — VEX IQ

VEX IQ — Now select platform Controller Mode: — TeleOp - when driven by remote control — Autonomous - when driving in autonomous mode

VEX — Select Communication mode: — VEXnet or USB is typical good, so it will work with field control system as well as via USB cable tethered to Computer to get DEBUG stream

RobotC - Firmware Updating By Willem Scholten Learning Access Institute

Firmware Updating Turn the Cortex OFF. 1 — VEX Cortex USB Port Plug the other end of the USB A-to-A cable into the USB port on the VEX Cortex. 2 — Plug the other end into your computer USB port

Firmware Updating Goto Robot -> Download Firmware -> Automatically Update VEX Cortex

Firmware Updating IF all is OK, press the OK button not proceed. IF update is required, the update will be applied, if the cortex is up-to-date you will informed as well

Firmware Updating Turn the VEXnet Remote Control OFF 1 — VEX Remote USB Port Plug the other end of the USB A-to-A cable into the USB port on the VEX Remote. 2 — Plug the other end into your computer USB port

Firmware Updating

Firmware Updating IF all is OK, press the OK button not proceed. IF update is required, the update will be applied, if the remote is up-to-date you will informed as well

By Willem Scholten Learning Access Institute Establish VEXnet Link By Willem Scholten Learning Access Institute

Establish VEXnet Link Install Batteries in the VEXnet Remote Control. Remove the battery cover plate on the remote control. Install 6 AAA batteries, and replace the battery cover plate. Do not power the remote control ON. Connect a Battery to the Cortex Connect a 7.2V robot battery to the Cortex, but do not power it ON.

Establish VEXnet Link 1 — Tether the USB port on the VEXnet Remote Control to the USB port on the Cortex using a USB A-to-A cable. 2 — VEXnet Remote Control USB Port Plug one end of the USB A-to-A cable into the USB port on the VEXnet Remote Control. 3 — VEX Cortex USB Port Plug the other end of the USB A-to-A cable into the USB port on the VEX Cortex.

Establish VEXnet Link Status LEDs — The ROBOT and VEXnet LEDs will blink green once the Cortex and VEXnet Remote Control have successfully paired. Power the Cortex ON. After a few seconds, ROBOT and VEXnet LEDs will blink green, indicating that the Cortex and VEXnet Remote Control have successfully paired.

Establish VEXnet Link Remove the USB A-to-A cable from the VEXnet Remote Control and Cortex. Turn the Cortex OFF.

Establish VEXnet Link VEXnet USB Keys — Insert VEXnet USB Keys into the VEXnet Remote Control and Cortex. Note: It does not matter which VEXnet USB Key you insert into the Cortex versus the VEXnet Remote Control. Pairing the Cortex and VEXnet Remote Control establishes the link; the VEXnet USB Keys act as antennas for the link.

Establish VEXnet Link Power the Cortex and Remote Control ON. After roughly 15 seconds, the ROBOT and VEXnet LED’s will blink green, indicating that the VEXnet communication link has been established. Turn the Cortex ON. Turn the VEXnet Remote Control ON

Establish VEXnet Link Status LEDs — After roughly 10 seconds, the ROBOT and VEXnet status LEDs will start blinking green. With the VEXnet link established, you should power OFF your Cortex and VEXnet Remote Control to preserve battery.

For VEX Cortex Using Remote Control in TeleOp RobotC Examples For VEX Cortex Using Remote Control in TeleOp

Typical Program Layout A basic RobotC program - either Telop or Autonomous consists of four key blocks: #pragma section - define the motors and sensors Program Description Comment Block Task Main() Functions

#pragma section - define the motors and sensors #pragma config(Sensor, dgtl1, limitSwitchUp, sensorTouch) #pragma config(Sensor, dgtl2, limitSwitchDown, sensorTouch) #pragma config(Motor, port2, rightMotor, tmotorServoContinuousRotation, openLoop, reversed) #pragma config(Motor, port3, leftMotor, tmotorServoContinuousRotation, openLoop) #pragma config(Motor, port6, armMotor, tmotorServoContinuousRotation, openLoop) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// The motor and sensor definitions must be at the top of the program, and is created using the Motor and Sensor ‘painter’ in the RobotC programming toolbar.

Pragma Section Two limit switches are defined, plugged into the digital port #1 and #2 on the Cortex #pragma config(Sensor, dgtl1, limitSwitchUp, sensorTouch) #pragma config(Sensor, dgtl2, limitSwitchDown, sensorTouch)

Pragma Section #pragma config(Motor, port2, rightMotor, tmotorServoContinuousRotation, openLoop, reversed) #pragma config(Motor, port3, leftMotor, tmotorServoContinuousRotation, openLoop) #pragma config(Motor, port6, armMotor, tmotorServoContinuousRotation, openLoop) Three motors are defined - two are for the drive train, and notice one is set to ‘reverse’. A third motor is for the lifting arm movement.

Program Description /*——————————————————————————————————————————— *\ |* - Dual Joystick Control with Arm - 2 Remotes - *| |* ROBOTC on VEX 2.0 Cortex *| |* *| |* This program uses the Left and the Right joysticks on Remote Control 1 to run the robot using *| |* "tank control". The Group 6 buttons on the top-right of Remote Control 2 are used to raise and *| |* lower the arm. *| |* *| |* ROBOT CONFIGURATION *| |* NOTES: *| |* 1) Ch1 is the X axis and Ch2 is the Y axis for the RIGHT joystick. *| |* 2) Ch3 is the Y axis and Ch4 is the X axis for the LEFT joystick. *| |* MOTORS & SENSORS: *| |* [I/O Port] [Name] [Type] [Description] *| |* Motor - Port 2 rightMotor VEX Motor Right motor *| |* Motor - Port 3 leftMotor VEX Motor Left motor *| |* Motor - Port 6 armMotor VEX Motor Arm motor *| \*—————————————————————————————————————————— */ Put a clear description of what your program does in the top, including any major revisions you may have made, and who is the author of the code.

task Main() task main() { while(1 == 1) //Driving Motor Control with Remote Control 1 motor[leftMotor] = vexRT[Ch3] / 2; motor[rightMotor] = vexRT[Ch2] / 2; //Arm Control with Remote Control 2 - allow up movement // as long as the upper limit switch is not pressed if(vexRT[Btn6UXmtr2] == 1 && SensorValue(limitSwitchUp) == 0) motor[armMotor] = 40; } // Allow down movement as long as bottom limit switch is not pressed else if(vexRT[Btn6DXmtr2] == 1 && SensorValue(limitSwitchDown) == 0) motor[armMotor] = -40; else motor[armMotor] = 0; task Main() is the main control task which is excited. Any robot control events you want to occur must be within this task statement.

Btn7U Btn7L Btn7R Btn8U Btn7D Btn8L Btn8R Btn8D Ch4 Ch1 Ch3 Ch2 Btn6U (X-axis) Ch1 (X-axis) Ch3 (Y-axis) Ch2 (Y-axis) Btn6U Btn5U Btn6D Btn5D

task Main() task main() { while(1 == 1) //Driving Motor Control with Remote Control 1 motor[leftMotor] = vexRT[Ch3] / 2; motor[rightMotor] = vexRT[Ch2] / 2; //Arm Control with Remote Control 2 - allow up movement // as long as the upper limit switch is not pressed if(vexRT[Btn6UXmtr2] == 1 && SensorValue(limitSwitchUp) == 0) motor[armMotor] = 40; } // Allow down movement as long as bottom limit switch is not pressed else if(vexRT[Btn6DXmtr2] == 1 && SensorValue(limitSwitchDown) == 0) motor[armMotor] = -40; else motor[armMotor] = 0; while( 1 == 1) This is an infinite execute loop. It is needed to continuously readout the Button actions on the Remote Control. If you don’t have this, the buttons would be read once and that is the end of it….

task Main() First in the loop, we control the drive motors. leftMotor is controlled by JoyStick Ch3 (Left JoyStick Y-axis), the rightMotor is controlled by JoyStick Ch2 (Left JoyStick X-axis). The position of the JoyStick which is from 127 — -127 is halted, does effectively driving the robot at half speed. task main() { while(1 == 1) //Driving Motor Control with Remote Control 1 motor[leftMotor] = vexRT[Ch3] / 2; motor[rightMotor] = vexRT[Ch2] / 2; //Arm Control with Remote Control 2 - allow up movement // as long as the upper limit switch is not pressed if(vexRT[Btn6UXmtr2] == 1 && SensorValue(limitSwitchUp) == 0) motor[armMotor] = 40; } // Allow down movement as long as bottom limit switch is not pressed else if(vexRT[Btn6DXmtr2] == 1 && SensorValue(limitSwitchDown) == 0) motor[armMotor] = -40; else motor[armMotor] = 0;

task Main() task main() { while(1 == 1) //Driving Motor Control with Remote Control 1 motor[leftMotor] = vexRT[Ch3] / 2; motor[rightMotor] = vexRT[Ch2] / 2; //Arm Control with Remote Control 2 - allow up movement // as long as the upper limit switch is not pressed if(vexRT[Btn6UXmtr2] == 1 && SensorValue(limitSwitchUp) == 0) motor[armMotor] = 40; } // Allow down movement as long as bottom limit switch is not pressed else if(vexRT[Btn6DXmtr2] == 1 && SensorValue(limitSwitchDown) == 0) motor[armMotor] = -40; else motor[armMotor] = 0; Second - Now we read the action on Button Group 6 and control the armMotor. Notice -we swapped to Remote Control #2 - the partner remote. But notice we are not just reading the RemoteControl state we are also adding in the state of two limitSwitches.

task Main() Get the State of the limitSwitch Address button if(vexRT[Btn6UXmtr2] == 1 && SensorValue(limitSwitchUp) == 0) Get the State of the limitSwitch 0 = not pressed 1 = pressed Address button on Remote 2 Append Xmtr2 to any button name and you are on the second (partner) remote. && - logic AND In this scenario, when Btn6U on Remote 2, is pressed and as long as the limitSwitch is not depressed you can move the arm up. As soon as the limitSwitch is pressed, you can press Btn6U all you want, but there will be no longer a motor movement upwards.

RobotC and Basic Drive Bot By Willem Scholten Learning Access Institute

Basic Drive Bot Setup

Basic Drive Bot Setup Things to note: Two mother used for driving LEFT DRIVE MOTOR and RIGHT DRIVE MOTOR Two motors used for actuators - CLAW MOTOR and ARM MOTOR

Basic Drive Bot Setup

Basic Drive Bot Setup NOTE: the LEFT and RIGHT DRIVE MOTORS are directly connected to either port #1 or port #10. These ports have build in speed control. Ports 2 - 9 are 3 wire ports and any MOTOR plugged in to those require the use of a PWM motor controller 29

Basic Drive Bot Setup Motor Controller Module — The Motor Controller 29 regulates the speed of a VEX motor based on a signal it receives from a VEX Microcontroller. This allows for control of any VEX motor that doesn’t have a built- in motor controller, such as the VEX 2-wire motors.

Basic Drive Bot Setup

Basic Drive Bot Setup

Basic Drive Bot Setup RobotC setup and configuration for the Basic Drive Bot Assuming motors are wired as shown in previous slides (Remember that can be any robot of your design as long as the motors are functioning and performing the “tasks” as shown) You have RobotC installed on your computer, and configured for VEX Cortex as shown earlier.

Basic Drive Bot Setup Steps we need to undertake in RobotC: 1 - define all the motors and connections 2 - create basic drive code using a while loop which continuously reads the remote control, and send actions to the motors based on the state of buttons and joysticks on the controller.

Basic Drive Bot Setup

Basic Drive Bot Setup Start a NEW PROGRAM

Define your CORTEX setup Basic Drive Bot Setup Define your CORTEX setup

Define which ports the motors are plugged into Basic Drive Bot Setup Define which ports the motors are plugged into When done, apply / and press OK This will create a special section in your code called #pragma

#PRAGMA section which is auto generated for you Basic Drive Bot Setup #PRAGMA section which is auto generated for you

Basic Drive Bot Setup Robot Definition Pragma Section Define your Robot configuration - motors, sensors etc Robot Definition Pragma Section while 1 == 1 Main control loop - run forever and scan the remote for any button changes, and act upon them This program does not end until you turn off the power Read continuously the state of the buttons, and take actions

Basic Drive Bot Setup Define your Robot configuration - motors, sensors etc while 1 == 1 LEFT and RIGHT motor get input for speed directly from Joystick F In the main loop there are IF THEN ELSE statements for each button you want to define and an action associated with it. IF vexRT[Btn5U] == 1 T Take Action

#pragma config(Motor, port1, leftMotor, tmotorVex393_HBridge, openLoop, reversed) #pragma config(Motor, port6, clawMotor, tmotorVex393_MC29, openLoop, reversed) #pragma config(Motor, port7, armMotor, tmotorVex393_MC29, openLoop, reversed) #pragma config(Motor, port10, rightMotor, tmotorVex393_HBridge, openLoop) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// task main () { while(1 == 1) //Driving Motor Control motor[leftMotor] = vexRT[Ch3] / 2; motor[rightMotor] = vexRT[Ch2] / 2; // Raise, lower or do not move arm if(vexRT[Btn5U] == 1) //If button 5U is pressed... motor[armMotor] = 127; //...raise the arm. } else if(vexRT[Btn5D] == 1) //Else, if button 5D is pressed... motor[armMotor] = -127; //...lower the arm. else //Else (neither button is pressed)... motor[armMotor] = 0; //...stop the arm. // Open, close or do not more claw if(vexRT[Btn6U] == 1) //If Button 6U is pressed... motor[clawMotor] = 127; //...close the gripper. else if(vexRT[Btn6D] == 1) //Else, if button 6D is pressed... motor[clawMotor] = -127; //...open the gripper. motor[clawMotor] = 0; //...stop the gripper.

VEX Robotics - RobotC Competition Template By Willem Scholten Learning Access Institute

VEXnet Competition Code Things to remember: You must name your Robot - this must be your team number You must use the supplied Competition Template for your code If you are doing the Skill Challenge, you must also use the Skill Challenge Template for that code

VEXnet Competition Code Set your Robot name - Robot -> Advanced Tools -> Rename Robot (make sure your PC is communicating with the Cortex when doing this) Set the new name - it should be your team number!

VEXnet Competition Code Writing Competition Code: Open the the competition_template from the Sample file menu Once opened - first do a Save As and re-name the template to something else and stored on your computer in a folder you can remember.

Competition Code filename: VEXcompetitionV01.c

VEXnet Competition Code Define your Robot configuration - motors, sensors etc Robot Definition Pragma Section In this section you should not change ANYTHING if you do your robot will not connect or interface with competition control system Competition System Pragma Section Code that runs one at power up to pre-position a claw for example Pre-Autonomous Section Code that runs during the autonomous portion of the competition Autonomous Task Section Code that runs during the Tele-op portion of the competition - make sure you ahem a while(true) loop reading constantly the remote control buttons! User Control Task Section

VEXnet Competition Code Robot definitions created using the the Motor and Sensor Setup Wizard -> should match exactly what you have configured on your robot and plugged into the Cortex Controller #pragma config(Motor, port1, leftMotor, tmotorVex393_HBridge, openLoop) #pragma config(Motor, port10, rightMotor, tmotorVex393_HBridge, openLoop, reversed) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

VEXnet Competition Code In this section you should not change ANYTHING if you do your robot will not connect or interface with competition control system //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// #pragma platform(VEX) //Competition Control and Duration Settings #pragma competitionControl(Competition) #pragma autonomousDuration(20) #pragma userControlDuration(120) #include "Vex_Competition_Includes.c" //Main competition background code...do not modify! /////////////////////////////////////////////////////////////////////////////////////////

VEXnet Competition Code Code that runs one at power up - in this case we move the robot forward for 3 seconds at half speed - in reality this should be for pre-positioning say a servo to have claw grab the cube. ///////////////////////////////////////////////////////////////////////////////////////// // // Pre-Autonomous Functions // You may want to perform some actions before the competition starts. Do them in the // following function. void pre_auton() { // Set bStopTasksBetweenModes to false if you want to keep user created tasks running between // Autonomous and Tele-Op modes. You will need to manage all user created tasks if set to false. bStopTasksBetweenModes = true; // All activities that occur before the competition starts // Example: clearing encoders, setting servo positions, ... // Willem: in this case we just have the robot move forward a bit to demonstrate // how the pre_autorun works. wait1Msec(2000); // Robot waits for 2000 milliseconds before executing program // Move forward at half power for 3 seconds motor[rightMotor] = 60; // Motor on port2 is run at full (127) power forward motor[leftMotor] = 60; // Motor on port3 is run at full (127) power forward wait1Msec(3000); // Robot runs previous code for 3000 milliseconds }

VEXnet Competition Code Read this parameter carefully - and do NOT remove it. If you wanted to run the Pre-Autnomous function again between the control system switching from Autonomous to User Controlled, then set this to ‘false’ but be careful, and test test test before doing so! // Set bStopTasksBetweenModes to false if you want to keep user created tasks running between // Autonomous and Tele-Op modes. You will need to manage all user created tasks if set to false. bStopTasksBetweenModes = true;

VEXnet Competition Code ///////////////////////////////////////////////////////////////////////////////////////// // // Autonomous Task // This task is used to control your robot during the autonomous phase of a VEX Competition. // You must modify the code to add your own robot specific commands here. task autonomous() { // ..................................................................................... // Insert user code here. //AutonomousCodePlaceholderForTesting(); // Remove this function call once you have "real" code. // Willem: We are going to a pivot turn to the right the not the left // Turn Right at full power for 0.75 seconds motor[rightMotor] = -127; // Motor on port2 is run at full (-127) power reverse motor[leftMotor] = 127; // Motor on port3 is run at full (127) power forward wait1Msec(750); // Robot runs previous code for 750 milliseconds before moving on // Turn Left at full power for 0.75 seconds motor[rightMotor] = 127; // Motor on port2 is run at full (127) power forward motor[leftMotor] = -127; // Motor on port3 is run at full (-127) power reverse motor[rightMotor] = 0; motor[leftMotor] = 0; }

VEXnet Competition Code By default this function call is not commented out, however as soon as you have your own code block in the Autonomous Task() section (blue code in previous slide) you MUST comment it out. You will get a warning message when compiling, but you can safely ignore this! (The message will be: WARNING: Unreferenced function AutonomousCodePlaceholderForTesting) //AutonomousCodePlaceholderForTesting(); // Remove this function call once you have "real" code.

VEXnet Competition Code Sample Autonomous Code - make a pivot turn to the right, then a pivot turn to the left. NOTICE: the motors are deliberately stopped when we want to, if we do not do this the motors will keep on running until the timer expires the autonomous period of the game! // Willem: We are going to a pivot turn to the right the not the left // Turn Right at full power for 0.75 seconds motor[rightMotor] = -127; // Motor on port2 is run at full (-127) power reverse motor[leftMotor] = 127; // Motor on port3 is run at full (127) power forward wait1Msec(750); // Robot runs previous code for 750 milliseconds before moving on // Turn Left at full power for 0.75 seconds motor[rightMotor] = 127; // Motor on port2 is run at full (127) power forward motor[leftMotor] = -127; // Motor on port3 is run at full (-127) power reverse motor[rightMotor] = 0; motor[leftMotor] = 0;

VEXnet Competition Code ///////////////////////////////////////////////////////////////////////////////////////// // // User Control Task // This task is used to control your robot during the user control phase of a VEX Competition. // You must modify the code to add your own robot specific commands here. task usercontrol() { // User control code here, inside the loop while (true) // This is the main execution loop for the user control program. Each time through the loop // your program should update motor + servo values based on feedback from the joysticks. // ..................................................................................... // Insert user code here. This is where you use the joystick values to update your motors, etc. //UserControlCodePlaceholderForTesting(); // Remove this function call once you have "real" code. // Willem: We are just inserting a basic tank control remote program here to demonstrate how it works //Driving Motor Control motor[leftMotor] = vexRT[Ch3] / 2; motor[rightMotor] = vexRT[Ch2] / 2; }

VEXnet Competition Code By default this function call is not commented out, however as soon as you have your own code block in the Usercontrol Task() section (green code in previous slide) you MUST comment it out. You will get a warning message when compiling, but you can safely ignore this! (The message will be: WARNING: Unreferenced function UserControlcodePlaceholderForTesting) //UserControlCodePlaceholderForTesting(); // Remove this function call once you have "real" code.

VEXnet Competition Code while (true) { // This is the main execution loop for the user control program. Each time through the loop // your program should update motor + servo values based on feedback from the joysticks. // ..................................................................................... // Insert user code here. This is where you use the joystick values to update your motors, etc. //UserControlCodePlaceholderForTesting(); // Remove this function call once you have "real" code. // Willem: We are just inserting a basic tank control remote program here to demonstrate how it works //Driving Motor Control motor[leftMotor] = vexRT[Ch3] / 2; motor[rightMotor] = vexRT[Ch2] / 2; } Main While loop reading constantly the Remote Control - all you code acting upon the various buttons of your remotes MUST be within this loop. Simple code driving the robot using the two joysticks on the remote control. Every button you want to use must be defined here with actions.