led#

Initializing the led Class#

An led object is created by using the following constructor:

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

Parameter

Description

port

The 3-Wire Port that the LED is connected to, whether it’s a port on the Brain, or a 3-Wire Expander.

A Brain or 3-Wire Expander must be created first before they can be used to create an object with the led Class constructor.

// 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.

Class Methods#

on()#

The on() method turns the LED on.

Returns: None.

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

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

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

off()#

The off() method turns the LED off.

Returns: None.

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

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

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