• VEXcode Robotics Logo VEX Robotics Logo
  • VEX API Home Button VEX API Home Button
  • VEX 123 logo in purple VEX 123 logo in white
  • VEX GO logo in lime green VEX GO logo in white
  • VEXcode AIM logo in blue VEXcode AIM logo in white
  • VEX IQ logo in blue VEX IQ logo in white
  • VEX EXP logo in red VEX EXP logo in white
  • VEX V5 logo in red VEX V5 logo in white
  • VEX CTE logo in green VEX CTE logo in white
  • VEX AIR logo in orange VEX AIR logo in white
  • VEXcode VR logo in gold VEXcode VR logo in white
Saltar al contenido principal
Ctrl+K

< Back to Platform Select

  • VEX IQ (2nd gen)
  • Bienvenido al sitio de referencia de API para VEX IQ (2.ª generación)
  • C++
  • Consola de impresión
Spanish
  • English
  • 简体中文
  • VEXcode Robotics Logo

Navegación de la sección

  • Bloques
  • Pitón
  • C++
    • Enumeraciones
    • cerebro
    • parachoques
    • color
    • sensor de color
    • controlador
    • distancia
    • drivetrain
    • evento
    • giroscopio
    • inercial
    • motor
    • grupo motor
    • óptico
    • neumático
    • Consola de impresión
    • unidad inteligente
    • sonar
    • hilo
    • tocado
    • Vision

Navegación de la plataforma

  • VEX 123 logo in purple VEX 123 logo in white
  • VEX GO logo in lime green VEX GO logo in white
  • VEXcode AIM logo in blue VEXcode AIM logo in white
  • VEX IQ logo in blue VEX IQ logo in white
  • VEX EXP logo in red VEX EXP logo in white
  • VEX V5 logo in red VEX V5 logo in white
  • VEX CTE logo in green VEX CTE logo in white
  • VEX AIR logo in orange VEX AIR logo in white
  • VEXcode VR logo in gold VEXcode VR logo in white

Consola de impresión#

  • Commands

    • Print to the Print Console

      • Format

      • New Lines

      • Different Colors

    • Clear the Print Console

Print Console commands are only available when using VEXcode IQ (2nd gen). If you are coding in VS Code, you will need to print to the V5’s Brain Screen using Brain.Screen commands.

All new projects begin with the cursor at row 1 in the Print Console.

Commands#

Print to the Print Console#

The printf(text) command prints text on the screen using the current cursor position.

Parámetros

Descripción

texto

La cadena (entre comillas) o números enteros que se imprimirán en la Consola de impresión.

Format#

Values being printed to the Print Console can use Format Specifiers to show values inside of your print statements.

  • %d - Decimal Integer

  • %f - Decimal Floating Point Number

  • %o - Signed Octal

  • %s - String of Characters

  • %x - Unsigned Hexadecimal Integer

  • %c - Character

This example will print the V5 Brain’s current time as a floating point number with 2 decimal places.

printf("Screen Pressed? %s\n", Brain.Screen.pressing());

Format Specifiers can also contain flags to modify them further:

  • %6f - This prints a floating point number that is a minimum of 6 characters wide.

  • %.2f - This prints a floating point number with 2 decimal places.

  • %6.2f - This prints a floating point number that is a minimum of 6 characters wide with 2 decimal places.

New Lines#

/n is a newline character, and it is required by the printf command to output any of its contents to the Print Console.

printf("This text will be ");
printf("printed on the same line\n");
printf("This is on a new line\n");

Different Colors#

You can change what color the text will be when printing to the Print Console by using the following color codes:

  • [31m - Red

  • [32m - Green

  • [34m - Blue

  • [30m - Black

  • [37m - White

  • [33m - Yellow

  • [91m - Orange

  • [35m - Purple

  • [36m - Cyan

  • [97m - Transparent

All color codes need to be attached to an escape sequence = \033 in order to function.

You can either use this directly in a print command with a string.

// Print VEXcode in Red to the Print Console.
printf("\033[31m VEXcode\n");

Or, you can use it on its own to set all print commands afterwards to the set color.

// Set the Print Console text color to Red before printing VEXcode.
printf("\033[31m");
printf("VEXcode\n");

Returns: None.

Clear the Print Console#

By using \033[2J\n inside of the printf command, you can clear the entire Print Console. This will also set the cursor back to row 1.

The example below will print “VEXcode” and then clear the Print Console after 2 seconds.

printf("VEXcode\n");
wait(2, seconds);
printf("\033[2J\n");

anterior

neumático

siguiente

unidad inteligente

En esta página
  • Commands
    • Print to the Print Console
      • Format
      • New Lines
      • Different Colors
    • Clear the Print Console
Innovation First, International

VEX y VEX Robotics son marcas comerciales o marcas de servicio de Innovation First, Inc. Copyright ©2025Todos los derechos reservados. VEX Robotics, Inc. es una subsidiaria de Innovation First International, Inc. Todos los demás nombres de productos o marcas de terceros son propiedad de sus respectivos dueños. Patentes y/o patentes en trámite - innovationfirst.com/patents
Política de privacidad del sitio / Términos de uso del sitio / Política de cookies / Política de privacidad del software

Visita la página de Facebook de VEX Robotics Visita la página de Twitter de VEX Robotics Visita la página de Instagram de VEX Robotics Visita la página de YouTube de VEX Robotics
Formulario de comentarios de la API de VEX

¡Valoramos tus comentarios! Usa este formulario para compartir sugerencias, felicitaciones o informar errores con la API de VEX. Tus comentarios nos ayudan a mejorar la documentación de la API de VEX.

Si tiene problemas técnicos o necesita asistencia al cliente, visite support.vex.com.

  • Send Happy Feedback
  • Send Sad Feedback

Nota: la URL actual se compartirá con tu mensaje.

Al incluir su dirección de correo electrónico, usted acepta que VEX puede enviarle correos electrónicos si tenemos preguntas sobre sus comentarios.
Política de privacidad >
Por favor, envíenos sus comentarios. ¡Comentarios enviados exitosamente!
Choose Which VEX IQ Generation to View

VEX IQ (1st gen)

VEX IQ (2nd gen)