In industry they use PLC’s, in the classroom we use arduino and VEX components. Mind boggling! It’s all done with some form of logic controller. Think about all of the systems that have to be controlled in a single work cell in a factory... then multiply it by 10’s or 100’s of cells. An image of this is shown below.When you think about it, in manufacturing, controlling things is necessary to perform very complex tasks to manufacture items to tolerances finer than a human hair. Select a compiling target by going to "Robot -> Compiler Target -> Virtual Worlds". Select a compiling target (real robot or virtual world robot). Sets the left and right motors to zero power, in other words, it stops the robot's forward motion.
#ROBOTC VEX PROGRAMMING TUTORIAL FULL#
* Note though that the previous code is still set so the motors are still at full power during these 2 seconds. * "wait1Msec(input_time)" Tells the program to wait 2000ms or 2 seconds before going on to read the next code. Sets the left and right motors to move forward at full power #pragma config(StandardModel, "RVW CLAWBOT") This basic program will drive the robot forward for two seconds and then stop the robot. We will practice with the virtual robots until you are ready for the physical ones.īelow is a basic program that you can copy and paste into your already open file. To use your first virtual robot you need two things:Ī program - A set of code written in C that is a set of instructions for what you want the robot to do.ĭownload the program onto your robot - In this case, you will send the program you write to a virtual robot, instead of a physical robot. Here is a link to a spreadsheet of the standard CLAWBOT setup: Link Some of the main parts of this setup are defining which ports each motor is plugged into, and giving them names such as "leftMotor" and "rightMotor". In RobotC, #pragma config(StandardModel, "RVW CLAWBOT") does the similar job of including a standard library of functions and set-up. As we discussed earlier, #include "stdio.h" includes a standard library of input and output functions such as "printf" and "scanf". This line of code is similar to #include "stdio.h" in your other C programming.
In your main RobotC interface, select "File -> New -> New File". YELLOW - This area shows you any errors that arise when compiling your code.
It lets you look at all of the files in your project. The "Solutions Explorer" is something that we won't use. The "Function Library" is an organized collection of all the available functions you can use in RobotC, such as what commands control the motor and what parameters these functions have. You can switch between "Function Library" and "Solutions Explorer" tabs at the bottom of this section. This is where you will type your code once you have a new coding file open (see how in the next section).īLUE - This area has two main jobs. GREEN - This is the main area that you will be working in. You can click on these to switch between programs/code that you have open and are working on. RED - This area holds the tabs of what you are working on, just like the tabs of an internet browser (Chrome, Safari, Mozilla, etc).