Hi there! My team switched to v5 this season and has been experimenting with both VCS and VexCode. However, we have discovered that unlike RobotC, where you could stream sensor values to the debug stream, there is no console/debug stream to print to in VCS, and while VexCode has a console, print functions (cout<<) have been disabled. Does anyone know a way to print sensor values or variables to the console? This would be super useful and I see no reason why it is not included.
printf(“foo bar\n”);
is what you are looking for. You need to end with \n so the stream is flushed, otherwise the output data stream will be buffered.
They are not disabled.
std::cout << "hello" << std::endl;
5 Likes
Thanks so much! I had not included std as I have never had to before in other C++ IDEs.
Thank you very much!
you can avoid using std, often this is included at the start of the file
using namespace std;
or, so as not to use the whole namespace and potentially cause name conflicts.
using std::cout;
using std::endl;
now you can use cout like this.
cout << "hello" << endl;
4 Likes
How would I print a variable ?
Thank you.
In standard C, it would look like:
int count=3;
printf( "variable count is equal to %i\n", count);
3 Likes