Class AR_Light

java.lang.Object
org.firstinspires.ftc.teamcode.AR_Light

public class AR_Light extends Object
This class is used to control the GoBilda PWM Light.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
     
    static final double
     
    static final double
     
    static final double
     
    static final double
     
    static final double
     
    static final double
     
    static final double
     
    static final double
     
    static final double
     
    static final double
     
    static final double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    AR_Light(String iLightName, com.qualcomm.robotcore.eventloop.opmode.LinearOpMode iBot)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Return immediately and sets the light's color to AZURE for use in update phase.
    void
    Return immediately and sets the light's color to BLUE for use in update phase.
    void
    customLight(double iColor)
    Return immediately and sets the light's color to CUSTOM for use in update phase.
    void
    flashLights(double iColor1, double iColor2)
    Return immediately after setting the light to perform a POLICE flash during updates.
    void
    Return immediately and sets the light's color to GREEN for use in update phase.
    void
    Return immediately and sets the light's color to INDIGO for use in update phase.
    void
    Return immediately and sets the light's color to ORANGE for use in update phase.
    void
    Return immediately after setting the light to perform a POLICE flash during updates.
    void
    Return immediately after setting the light to perform a RAINBOW flash during updates.
    void
    Return immediately and sets the light's color to RED for use in update phase.
    void
    Return immediately and sets the light's color to SAGE for use in update phase.
    void
    Return immediately and turns the light OFF for use in update phase.
    void
    strobeLights(double iPrimaryColor, double iSecondaryColor, int iDuration, int iFlashDuration)
    Returns immediately after setting the variables for the Strobe Effect.
    void
    This method should be called within the OpModes main loop, so as to update the light frequently.
    void
    Return immediately and sets the light's color to VIOLET for use in update phase.
    void
    Returns immediately after setting the variables for the Strobe Effect.
    void
    Return immediately and sets the light's color to WHITE for use in update phase.
    void
    Return immediately and sets the light's color to YELLOW for use in update phase.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • AR_Light

      public AR_Light(String iLightName, com.qualcomm.robotcore.eventloop.opmode.LinearOpMode iBot)
      Constructor. Perform the setup of the Light. The light is accessed like it is a servo, using the setPosition and getPosition methods for control.
      Parameters:
      iLightName - String used to identify light in Hardware Map.
      iBot - Object to OpMode so you can access HardwareMap, etc.
  • Method Details

    • updateLight

      public void updateLight()
      This method should be called within the OpModes main loop, so as to update the light frequently. When called, the function will perform the light action that is requested within the "currentMode" variable.
    • stopLight

      public void stopLight()
      Return immediately and turns the light OFF for use in update phase.
    • customLight

      public void customLight(double iColor)
      Return immediately and sets the light's color to CUSTOM for use in update phase. The color passed into the value variable will be the color used.
      Parameters:
      iColor - The value of the custom color. A double between 0 and 1.
    • redLight

      public void redLight()
      Return immediately and sets the light's color to RED for use in update phase.
    • orangeLight

      public void orangeLight()
      Return immediately and sets the light's color to ORANGE for use in update phase.
    • yellowLight

      public void yellowLight()
      Return immediately and sets the light's color to YELLOW for use in update phase.
    • sageLight

      public void sageLight()
      Return immediately and sets the light's color to SAGE for use in update phase.
    • greenLight

      public void greenLight()
      Return immediately and sets the light's color to GREEN for use in update phase.
    • azureLight

      public void azureLight()
      Return immediately and sets the light's color to AZURE for use in update phase.
    • blueLight

      public void blueLight()
      Return immediately and sets the light's color to BLUE for use in update phase.
    • indigoLight

      public void indigoLight()
      Return immediately and sets the light's color to INDIGO for use in update phase.
    • violetLight

      public void violetLight()
      Return immediately and sets the light's color to VIOLET for use in update phase.
    • whiteLight

      public void whiteLight()
      Return immediately and sets the light's color to WHITE for use in update phase.
    • flashLights

      public void flashLights(double iColor1, double iColor2)
      Return immediately after setting the light to perform a POLICE flash during updates. Colors will alternate between RED and BLUE.
      Parameters:
      iColor1 - flashing color 1
      iColor2 - flashing color 2
    • policeLights

      public void policeLights()
      Return immediately after setting the light to perform a POLICE flash during updates. Colors will alternate between RED and BLUE.
    • rainbowLights

      public void rainbowLights()
      Return immediately after setting the light to perform a RAINBOW flash during updates. Colors will sequence through RED, ORANGE, YELLOW, GREEN, BLUE, INDIGO, and VIOLET. At the end it will return to RED.
    • strobeLights

      public void strobeLights(double iPrimaryColor, double iSecondaryColor, int iDuration, int iFlashDuration)
      Returns immediately after setting the variables for the Strobe Effect. For, example, giving it the parameters of RED, OFF, 250, 1000 would make the light flash RED for a quarter of a second, then be OFF for the remainder of the 1000 ms (750ms).
      Parameters:
      iPrimaryColor - This color is the "flash" of the strobe. Takes a double between 0 and 1 or one of the predefined colors like GB_CLR_RED, etc.
      iSecondaryColor - This color id used when the "flash" isn't happening. This can be any color, including "off". Takes a double between 0 and 1 or one of the predefined colors like GB_CLR_RED, etc.
      iDuration - The frequency of the "flashes". Milliseconds
      iFlashDuration - How long the "flash" lasts. Milliseconds
    • waveLights

      public void waveLights()
      Returns immediately after setting the variables for the Strobe Effect. For, example, giving it the parameters of RED, OFF, 250, 1000 would make the light flash RED for a quarter of a second, then be OFF for the remainder of the 1000 ms (750ms).