Package org.firstinspires.ftc.teamcode
Class AR_Light
java.lang.Object
org.firstinspires.ftc.teamcode.AR_Light
This class is used to control the GoBilda PWM Light.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doublestatic final doublestatic final doublestatic final doublestatic final doublestatic final doublestatic final doublestatic final doublestatic final doublestatic final doublestatic final doublestatic final double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidReturn immediately and sets the light's color to AZURE for use in update phase.voidReturn immediately and sets the light's color to BLUE for use in update phase.voidcustomLight(double iColor) Return immediately and sets the light's color to CUSTOM for use in update phase.voidflashLights(double iColor1, double iColor2) Return immediately after setting the light to perform a POLICE flash during updates.voidReturn immediately and sets the light's color to GREEN for use in update phase.voidReturn immediately and sets the light's color to INDIGO for use in update phase.voidReturn immediately and sets the light's color to ORANGE for use in update phase.voidReturn immediately after setting the light to perform a POLICE flash during updates.voidReturn immediately after setting the light to perform a RAINBOW flash during updates.voidredLight()Return immediately and sets the light's color to RED for use in update phase.voidReturn immediately and sets the light's color to SAGE for use in update phase.voidReturn immediately and turns the light OFF for use in update phase.voidstrobeLights(double iPrimaryColor, double iSecondaryColor, int iDuration, int iFlashDuration) Returns immediately after setting the variables for the Strobe Effect.voidThis method should be called within the OpModes main loop, so as to update the light frequently.voidReturn immediately and sets the light's color to VIOLET for use in update phase.voidReturns immediately after setting the variables for the Strobe Effect.voidReturn immediately and sets the light's color to WHITE for use in update phase.voidReturn immediately and sets the light's color to YELLOW for use in update phase.
-
Field Details
-
GB_CLR_OFF
public static final double GB_CLR_OFF- See Also:
-
GB_CLR_RED
public static final double GB_CLR_RED- See Also:
-
GB_CLR_ORANGE
public static final double GB_CLR_ORANGE- See Also:
-
GB_CLR_YELLOW
public static final double GB_CLR_YELLOW- See Also:
-
GB_CLR_SAGE
public static final double GB_CLR_SAGE- See Also:
-
GB_CLR_GREEN
public static final double GB_CLR_GREEN- See Also:
-
GB_CLR_AZURE
public static final double GB_CLR_AZURE- See Also:
-
GB_CLR_BLUE
public static final double GB_CLR_BLUE- See Also:
-
GB_CLR_INDIGO
public static final double GB_CLR_INDIGO- See Also:
-
GB_CLR_VIOLET
public static final double GB_CLR_VIOLET- See Also:
-
GB_CLR_WHITE
public static final double GB_CLR_WHITE- See Also:
-
FLASH_RATE
public static final double FLASH_RATE- See Also:
-
-
Constructor Details
-
AR_Light
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 1iColor2- 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". MillisecondsiFlashDuration- 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).
-