Windows Inputs - In your main body of code, we will leave a forever loop running that will constantly detect when buttons are pressed. This sets up the main joystick commands and functions that you will write in RobotC
#Robotc vex tutorial code
RobotC Commands - At the top of the code you are writing you need to include #include "JoystickDriver.c" We need to include two main things in your code to correctly get access to the controller: Just like you need to include #pragma config(StandardModel, "RVW CLAWBOT") in your code to tell RobotC which robot your are using (CLAWBOT), you need to tell RobotC that you will be using commands, functions and variables from a controller input. This is often the easiest fix if you have extra controllers lying around.
#Robotc vex tutorial install
If this does not work correctly, you really have two options:įind the correct drivers on the internet that match your Operating System and actual controller you are holding, download these, install them and try again. As soon as you press the "Play" button, it is now running only your compiled program and not any built-in RobotC code. If you compile and download a program to your virtual robot in Level Builder, you can freely use these controller buttons until you press the "Play" button. The standard controller setup shown in the table above is a built-in feature of RobotC Level Builder. The RobotC Level Builder actually has a built-in controller mode (partially).
#Robotc vex tutorial how to
How to Set Up VJoy - This takes you through the actual setup of VJoy, describing how to use and a few common issues that might arise. What is VJoy - A brief explanation of what this stands for and how we will use it. Macro - The idea is that you can pre-program certain sets of instructions to a single button click such as "turn 90 degrees", or any string of commands. Also, this shows you which button is named which.Īctual Coding Names for a Handheld Controller - How to discover which buttons, joysticks, triggers and d-pad inputs are called what in RobotC. Important Note - Debugger Window - In RobotC it is often necessary to open the joystick debugger window for RobotC to detect inputs from Windows at all. Sample Code to Use a Controller - This is a sample code you can copy and paste into RobotC that will allow you to move forward by pressing a button on your controller. Overall Logic of Coding a Controller - Goes over the overall logic of writing your code for controller mode. This page goes over how to set this up and the necessary code you will write.īuilt in Controller Mode (partially) - Briefly explains how RobotC Level Builder has a built in controller mode (partially).Ĭonnecting your USB Controller to Your Computer - How to plug in a handheld USB controller to Windows, how to make sure it is being detected, and how to check which buttons are which.Ĭoding Joystick Configuration in RobotC - What necessary lines of code you need to write to be able to use a handheld controller with RobotC In this lesson, we will be working on controlling our robot with some form of handheld controller - A USB video game controller plugged into the computer and the VEX Controller for the physical robot.