All pages
Powered by GitBook
1 of 3

Loading...

Loading...

Loading...

Digital LED Indicator

Digital LED Indicator - Overview

The Digital LED Indicator (REV-31-2010) is a LED signal module that is digitally controlled (active low) and offers three colors: red, green, and amber. The Digital LED Indicator is designed to directly interface with the DIO ports of the Control Hub and Expansion Hub.When using the Digital LED Indicator outside of the REV Hub environment, make sure to check that your device GPIO pins’ current sink rating can handle 20mA.

REV-31-2010 Kit Contents

Part Number

Description

Qty

-

Digital LED Indicator

4

REV-31-1407

JST PH 4-Pin Sensor Cable

4

Specifications

Electrical Specifications

​Parameters

​Value and Units

Operating Voltage

3.3V

Current Draw (at 3.3V)

20mA - single LED40mA - both LEDs

Input Type

DIO (Active Low)

Color Modes

Red (Single LED on) Green (Single LED on) Amber (both LEDs on)

Forward Voltage

2.2V (Green)2.1V (Red)

Viewing Angle

170 degrees

Dimensions

28mm x 13.5mm

Mounting Hole Diameter

3.81mm (0.15")

Output Modes

n Digital Input

n+1 Digital Input

LED Mode

High

High

Off

High

Low

Green

Low

High

Red

Low

Low

Amber

Pinout

Mechanical Drawing

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 .

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

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;

@TeleOp

public class LEDCode extends LinearOpMode {
    private DigitalChannel touch;
    private DigitalChannel redLED;
    private DigitalChannel greenLED;


    @Override
    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
        waitForStart();
        
            // change LED mode from input to output
            redLED.setMode(DigitalChannel.Mode.OUTPUT);
            greenLED.setMode(DigitalChannel.Mode.OUTPUT);

        // Loop while the Op Mode is running
            while (opModeIsActive()) {
                if (touch.getState()){
                //Touch Sensor is not pressed 
                    greenLED.setState(false);
                    redLED.setState(true);
                
                } else {
                    //Touch Sensor is pressed
                    redLED.setState(false);
                    greenLED.setState(true);
            }
        
        }
    }
}
pinout