Application Examples

The Digital LED Indicator produces light that is usable as visual feedback for a human user. Using the Digital LED Indicator to show what state the robot is in is useful for debugging autonomous and teleoperated programs. Other sensors used with the LED Indicator can let robot operators know a variety of things, from if the robot has game elements to the robot being blocked from completing an action.

FIRST Tech Challenge

Configuring in the Control System

Configure the green LED on port 0 as "green." Configure the red LED on port 1 as "red."
Each digital port on the Control (or Expansion) Hub is capable of acting as two separate ports, thanks to the two channels of communication. This is why the ports are marked as 0-1, 2-3, etc. The n+1 channel operates on odd-numbered ports 1-7 and the n channel operates on the even number ports 0-6. Due to the two channels of communication, the green and red LED must be configured on the ports that correspond with their respective channel of communication.
More information on digital ports and the channels of of communication on the Control and Expansions Hubs can be found in the Digital Sensor documentation. More information on the communication channels that the LED Indicator uses can be found in the pinout.

Programming Examples

The sample code below changes the color of the Digital LED Indicator based on the state of a Touch Sensor (REV-31-1425).
OnBot Java
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.hardware.LED;
import com.qualcomm.robotcore.hardware.DigitalChannel;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.util.ElapsedTime;
public class LEDCode extends LinearOpMode {
private DigitalChannel touch;
private DigitalChannel redLED;
private DigitalChannel greenLED;
public void runOpMode() {
// Get the LED colors and touch sensor from the hardwaremap
redLED = hardwareMap.get(DigitalChannel.class, "red");
greenLED = hardwareMap.get(DigitalChannel.class, "green");
touch = hardwareMap.get(DigitalChannel.class, "touch");
// Wait for the play button to be pressed
// change LED mode from input to output
// Loop while the Op Mode is running
while (opModeIsActive()) {
if (touch.getState()){
//Touch Sensor is not pressed
} else {
//Touch Sensor is pressed
Last modified 2yr ago