Hi, guys! It’s my first time doing VEX programming, and I have no idea how to start. I downloaded Visual Studio with PROS, but from there, I’m lost. Any help would be appreciated!!!
Hi! Have you done any programming before? If you have, then you can pick between Python or C++, depending on what you’re most familiar with. If not, then I’d recommend Python as it is the easiest for beginners. You can always use Blocks (a Scratch like langage) if you aren’t too keen on text-based programming.
Once you have decided on this, then I would use the web version of VexCode (you can switch it to python mode). This will act as a documentation for you to see what different functions you have available to you. This will range from different sensing functions to movement. Add any devices/motors/sensor on the side.
Hope this helps and do let me know if you have any specific questions.
I would not suggest PROS for beginning programming. Instead, I would suggest getting the normal vex extension and using that. After installing the extension, click on the vex icon on the left and select “New Project”.
After that, select V5 and either Python or C++. I would suggest using a Clawbot example project so that you have pre-written code to look at. I don’t know how you do it in Python but the only complicated thing left in C++ is how you define motors. Click on the “src” folder on the left and open the “robot-config.cpp” file, is should look something like this but not exactly since mine is a different project.
This is one of the two files you use to declare new motors and devices. In this file, below the line that says “brain Brain;” but above the line that says “bool RemoteControlEnabled = true;” you define a new motor or device by creating a new object of that device’s class. You do that by writing the type of device like “motor”, the name you give the device (can be anything that doesn’t have spaces or starts with a number), and " = (PORT#, (motor ratio, normally 18_1), true or false if you want the motor to be reversed)
so in total: [Device Class Name] [User Given Name] = [Device Class Name]([Parameters for the device]);
example: motor Grabber = motor(Port5, ratio18_1, false);
This defines a green motor on port 5 that is not reversed.
To use this motor in the main code, you need to extern it in the second file called “robot-config.h” In the “Include” folder, It should look like this but with fewer lines since I have more defined.
Inside this file, just type “extern [Device Class Type] [User Given Name];”
Going with the previous example, this is what you would write:
extern motor Grabber;
Once that is done you can now code like normal inside the main.cpp file in the src folder.