VEXcode printf error

@levipope The terminal tab in VEXcode is for logs coming from your user program via “printf” and “cout<<”. It does not allow for input of any kind in its’ current state.

I tried the printf(“Hello World”); while the V5 controller was connected to the laptop but did not get anything in the terminal window. Am I missing something here?

Have you update the v5 brain to vexos 1.0.6 ?

Yes VEXos 1.0.6 - V5 Beta Brain and Controller

I am seeing the following error on the console:

Device: /dev/tty.usbmodem142303
/dev/tty.usbmodem142303: No such file or directory
v5terminal V1.0
Device: /dev/tty.usbmodem142303
v5terminal exit

I used the example competition template to make sure I did not insert errors. Here is the snippet:

    pre_auton();
       
       printf("hello world");
    //Prevent main from exiting with an infinite loop.                        
    while(1) {
      vex::task::sleep(100);//Sleep the task for a short amount of time to prevent wasted resources.
    }    
       

I am using a Mac OS X laptop.

I moved these posts to a new topic
Hm, interesting.
The v5terminal program is a small helper app that is used when we are connected directly to the V5 brain using USB. When we are connected to the controller we have to use a different path, it’s handled by the embedded v5manager client that we use for program download.

can you send output of ls /dev/tty.usb* types in the OSX terminal. The controller should show as a device ending with 2, so in your case something like /dev/tty.usbmodem142302

Are you using any USB hubs ? Is the Mac using a USB-C adapter ? Which version of OS ?

Ok I think I figured it out,

printf(“Hello World”);

will not print…

while,

printf(“Hello World\n”);

will…

ok, yea, you would have to flush stdout using the first version. stdio libraries will often buffer several k of data, using \n forces a buffer flush.

this would flush stdout

fflush(stdout);

Yes, external USB interface being used:
/dev/tty.usbmodem142302

Mac OS X 10.14.3

so is it working ok from controller now ? or only when connected directly using USB ?

thanks!

Joys of buffered streams.

One other thing
if you are using printf via the controller, it’s best to enable the Download channel on connect setting. This causes a switch to the high speed download radio channel whenever the controller is connected, not just when we download a program.