condujo#

Inicializando la clase led#

Un objeto led se crea utilizando el siguiente constructor:

The led constructor creates an led object in the specified Three Wire Port:

Parámetro

Descripción

port

El puerto de 3 cables al que está conectado el LED, ya sea un puerto en el Cerebro o un Expandedor de 3 cables.

Primero se debe crear un Brain o un 3-Wire Expander antes de poder usarlos para crear un objeto con el constructor de clase led.

// Create the Brain.
brain Brain;
// Construct an LED "LED" with the led class.
led LED = led(Brain.ThreeWirePort.A);

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

Métodos de clase#

on()#

The on() method turns the LED on.

Devoluciones: Ninguna.

// Turn on the LED.
LED.on();

// Wait 2 seconds.
wait(2, seconds.);

// Turn off LED.
LED.off();

apagado()#

The off() method turns the LED off.

Devoluciones: Ninguna.

// Turn on the LED.
LED.on();

// Wait 2 seconds.
wait(2, seconds);

// Turn off LED.
LED.off();