LogoLogo
revrobotics.com
  • Welcome
  • REV Hardware Client
  • REV Crossover
  • FIRST Global
  • REV Crossover
    • REV Crossover Landing
  • Sensors
    • Through Bore Encoder
      • Specifications
      • Application Examples
    • Color Sensor V3
      • Specifications
      • Application Examples
      • Discontinued Color Sensors
        • V2 Specifications & Examples
        • V1 Specifications & Examples
    • 2m Distance Sensor
      • Specifications
      • Application Examples
    • Magnetic Limit Switch
      • Specifications
      • Application Examples
    • Touch Sensor
      • Specifications
      • Application Examples
    • Potentiometer
      • Specifications
      • Application Examples
    • 9-Axis IMU
      • Specifications
      • Configuring the 9-Axis IMU
  • Blinkin LED Driver
    • Blinkin LED Driver Overview
    • Blinkin Specifications
    • Blinkin Getting Started
      • LED Pattern Tables
    • Blinkin Troubleshooting
    • REV ION Application Examples
    • REV DUO Application Examples
  • UltraPlanetary System
    • UltraPlanetary System Overview
    • UltraPlanetary Features
    • Cartridge Details
    • Load Ratings
    • Assembly Instructions
    • Mounting Brackets
    • Ultra 90 Degree Gearbox
      • Assembly Instructions
      • Rotation Direction
  • Servos & Accessories
    • Servo Hub
      • Servo Hub Wiring
      • Configuring the Servo Hub with a Control Hub
      • Channel Power
      • Channel Pulse
      • Servo Hub Status LED Patterns
      • Troubleshooting
      • REVLib for Servo Hub
    • Smart Robot Servo
      • SRS Gear Replacement
    • SRS Programmer
      • Switching Operating Modes
    • Servo Power Module
  • Indicators
    • Digital LED Indicator
      • Specifications
      • Application Examples
  • Gamepad
    • Gamepad Overview
    • Remapping Guide
Powered by GitBook

Need more help?

  • Email: support@revrobotics.com
  • Phone Number: 844-255-2267
On this page

Was this helpful?

Export as PDF
  1. Indicators
  2. Digital LED Indicator

Application Examples

PreviousSpecificationsNextGamepad Overview

Last updated 11 months ago

Was this helpful?

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.

Programming Examples

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);
            }
        
        }
    }
}

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 .

The sample code below changes the color of the Digital LED Indicator based on the state of a Touch Sensor ().

REV-31-1425
pinout