Cerebro#

Inicializando la clase Brain#

Para utilizar los métodos de Brain en su proyecto, comience inicializándolo de la siguiente manera:

# Create a new object "brain" with the Brain class.
brain = Brain()

This brain object will be used in all subsequent examples throughout this API documentation when referring to Brain class methods.

Métodos de clase#

Métodos de apariencia#

imprimir()#

The print(text, sep, precision) method prints text on the screen using the current cursor position.

Parámetros

Descripción

text

El texto a imprimir.

sep

Optional. A string to inset between values. This must be written as a keyword argument (sep=). The default is ” “.

precision

Optional. The number of decimal places to display when printing simple numbers. This must be written as a keyword argument(precision=). The default is 2.

Devoluciones: Ninguna.

# Print the number 1 on the Brain's screen at current
# cursor position.
brain.print(1)

# Print the numbers 1, 2, 3 and 4 on the Brain's screen at
# current cursor position separated by a '-'.
brain.print(1, 2, 3, 4, sep='-')

nueva_línea()#

The new_line() method moves the cursor to a new line.

Devoluciones: Ninguna.

claro()#

The clear(color) method clears the Print Console.

Devoluciones: Ninguna.

# Print VEXcode on the Print Console.
brain.print("VEXcode")

# Clear the Print Console after 2 seconds.
wait(2, SECONDS)
brain.clear()

establecer_color_de_impresión()#

The set_print_color(color) method sets the text color to be printed in the Print Console.

Parámetros

Descripción

color

A valid ColorType, a hex value, or a web string.

Devoluciones: Ninguna.

# Set pen color red using a hex value.
brain.set_print_color(0xFF0000)

Métodos de detección#

reinicio del temporizador()#

The timer_reset() method resets the timer’s value.

Devoluciones: Ninguna.

tiempo_del_temporizador()#

The timer_time(units) method returns the elapsed time.

Parámetros

Descripción

units

A valid TimeUnits type. The default is MSEC.

Devuelve: El tiempo transcurrido en la unidad especificada.