Coverting c++ text into blocks on VEXcode V5

My friend made a c++ program to help show me something with the inertial sensor on our robot but I only know how to code in blocks. So I was wondering how I can transfer the program on VEXcode V5. I am able to turn a blocks program into C++, but not vice versa. Why is that and how can I change that?

1 Like

Hi @The_Legacy, welcome to the VEX Forum!

Converting blocks code to C++ is easy, there are only a relatively small number of blocks and each one corresponds directly to a one or two lines of C++ code. In fact, translating blocks to C++ is (I’m pretty sure) the first step in compiling a VEXcode V5 blocks program anyway, so all they had to do to add that feature was expose it in the user interface.

Converting in the other direction, though, is a much more difficult problem, largely because there are many things you can do in C++ that do not easily correspond to a single block. As a result, converting from text to blocks is not a feature of VEXcode, and (if I had to guess) probably never will be.

So, you’ll have to do the conversion yourself. I would encourage you to try it on your own as a learning exercise, but if you get stuck, share the C++ code in this thread and someone will be able to point you in the right direction.


Thank you very much! I will definitely try to work on it.

There is also an example project in VEXcode V5 (go to file -> open examples -> choose the sensing category) that uses blocks. You may find that helpful also.