public class SoftPWMRGB extends Object
Modifier and Type | Field and Description |
---|---|
static int |
BLUE_COLOUR |
private int |
blueLevel
The Level of the Blue LED GPIO pin - it is the PWM duty.
|
private int |
bluePinNumber
The GPIO Pin number (wiringPi/Pi4J) that will be connected to the Blue LED.
|
static int |
GRADIENT_SLEEPSPEED |
static int |
GRADIENT_STEPSIZE |
static int |
GREEN_COLOUR |
private int |
greenLevel
The Level of the Green LED GPIO pin - it is the PWM duty.
|
private int |
greenPinNumber
The GPIO Pin number (wiringPi/Pi4J) that will be connected to the Green LED.
|
static int |
RED_COLOUR |
private int |
redLevel
The Level of the Red LED GPIO pin - it is the PWM duty.
|
private int |
redPinNumber
The GPIO Pin number (wiringPi/Pi4J) that will be connected to the Red LED.
|
private static BufferedReader |
stdin
Used for user commandline input.
|
static int |
WHITE_COLOUR |
Constructor and Description |
---|
SoftPWMRGB()
Instantiates and gets the initial pins setup for use.
|
Modifier and Type | Method and Description |
---|---|
void |
cycleAllGradients(int numLoops) |
void |
cycleAllGradients(int numLoops,
int onLevel) |
int |
getBlueLevel()
Get Method for class field 'blueLevel'.
|
int |
getBluePinNumber()
Returns the value of bluePinNumber.
|
int |
getGreenLevel()
Get Method for class field 'greenLevel'.
|
int |
getGreenPinNumber()
Returns the value of greenPinNumber.
|
int |
getRedLevel()
Get Method for class field 'redLevel'.
|
int |
getRedPinNumber()
Returns the value of redPinNumber.
|
void |
gradualBlueOff() |
void |
gradualBlueOff(int onLevel) |
void |
gradualBlueOff(int stepSize,
int sleepSpeedMillis) |
void |
gradualBlueOn() |
void |
gradualBlueOn(int onLevel) |
void |
gradualBlueOn(int stepSize,
int sleepSpeedMillis) |
void |
gradualGreenOff() |
void |
gradualGreenOff(int onLevel) |
void |
gradualGreenOff(int stepSize,
int sleepSpeedMillis) |
void |
gradualGreenOn() |
void |
gradualGreenOn(int onLevel) |
void |
gradualGreenOn(int stepSize,
int sleepSpeedMillis) |
void |
gradualOff(int rgbColour) |
void |
gradualOff(int rgbColour,
int stepSize,
int sleepSpeedMillis) |
void |
gradualOff(int rgbColour,
int onLevel,
int stepSize,
int sleepSpeedMillis)
Gradually steps the PWM colour down to the specified level.
|
void |
gradualOn(int rgbColour) |
void |
gradualOn(int rgbColour,
int stepSize,
int sleepSpeedMillis) |
void |
gradualOn(int rgbColour,
int onLevel,
int stepSize,
int sleepSpeedMillis)
Gradually steps the PWM colour up to the specified level.
|
void |
gradualRedOff() |
void |
gradualRedOff(int onLevel) |
void |
gradualRedOff(int stepSize,
int sleepSpeedMillis) |
void |
gradualRedOn() |
void |
gradualRedOn(int onLevel) |
void |
gradualRedOn(int stepSize,
int sleepSpeedMillis) |
void |
gradualWhiteOff() |
void |
gradualWhiteOff(int onLevel) |
void |
gradualWhiteOff(int stepSize,
int sleepSpeedMillis) |
void |
gradualWhiteOn() |
void |
gradualWhiteOn(int onLevel) |
void |
gradualWhiteOn(int stepSize,
int sleepSpeedMillis) |
int |
initBluePWMPin()
Provisions the blue Pin as a PWM pin.
|
int |
initGreenPWMPin()
Provisions the Green Pin as a PWM pin.
|
private int |
initPWMPin(int pin)
This provisions/creates a software controlled PWM pin.
|
int |
initRedPWMPin()
Provisions the Red Pin as a PWM pin.
|
static void |
main(String[] args)
Run the demo from here.
|
void |
setBlueLevel(int blueLevel)
Set Method for class field 'blueLevel'.
|
void |
setBluePinNumber(int bluePinNumber)
Sets the value of redPinNumber and re-inits the bluePin GPIO Pin Object.
|
void |
setGreenLevel(int greenLevel)
Set Method for class field 'greenLevel'.
|
void |
setGreenPinNumber(int greenPinNumber)
Sets the value of redPinNumber and re-inits the greenPin GPIO Pin Object.
|
void |
setRedLevel(int redLevel)
Set Method for class field 'redLevel'.
|
void |
setRedPinNumber(int redPinNumber)
Sets the value of redPinNumber and re-inits the redPin GPIO Pin Object.
|
static boolean |
sleep(long waitTime)
A method to simply abstract the Try/Catch required to put the current
thread to sleep for the specified time in ms.
|
static String |
userInput(String prompt)
gather user input from the commandline.
|
private static final BufferedReader stdin
public static final int RED_COLOUR
public static final int GREEN_COLOUR
public static final int BLUE_COLOUR
public static final int WHITE_COLOUR
public static final int GRADIENT_STEPSIZE
public static final int GRADIENT_SLEEPSPEED
private int redPinNumber
private int greenPinNumber
private int bluePinNumber
private int redLevel
private int greenLevel
private int blueLevel
public SoftPWMRGB()
public int getRedPinNumber()
public void setRedPinNumber(int redPinNumber)
redPinNumber
- The GPIO Pin Number for the Red.public int getGreenPinNumber()
public void setGreenPinNumber(int greenPinNumber)
greenPinNumber
- The GPIO Pin Number for the Green LED .public int getBluePinNumber()
public void setBluePinNumber(int bluePinNumber)
bluePinNumber
- The GPIO Pin Number for the blue LED .public void setRedLevel(int redLevel)
redLevel
- is the value to set this class field to.public int getRedLevel()
public void setGreenLevel(int greenLevel)
greenLevel
- is the value to set this class field to.public int getGreenLevel()
public void setBlueLevel(int blueLevel)
blueLevel
- is the value to set this class field to.public int getBlueLevel()
private int initPWMPin(int pin)
pin
- is the wiringPI pin number to initialize as a PWM pin.public int initRedPWMPin()
public int initGreenPWMPin()
public int initBluePWMPin()
public void gradualRedOn()
public void gradualRedOn(int onLevel)
public void gradualRedOn(int stepSize, int sleepSpeedMillis)
public void gradualGreenOn()
public void gradualGreenOn(int onLevel)
public void gradualGreenOn(int stepSize, int sleepSpeedMillis)
public void gradualBlueOn()
public void gradualBlueOn(int onLevel)
public void gradualBlueOn(int stepSize, int sleepSpeedMillis)
public void gradualWhiteOn()
public void gradualWhiteOn(int onLevel)
public void gradualWhiteOn(int stepSize, int sleepSpeedMillis)
public void gradualOn(int rgbColour)
public void gradualOn(int rgbColour, int stepSize, int sleepSpeedMillis)
public void gradualRedOff()
public void gradualRedOff(int onLevel)
public void gradualRedOff(int stepSize, int sleepSpeedMillis)
public void gradualGreenOff()
public void gradualGreenOff(int onLevel)
public void gradualGreenOff(int stepSize, int sleepSpeedMillis)
public void gradualBlueOff()
public void gradualBlueOff(int onLevel)
public void gradualBlueOff(int stepSize, int sleepSpeedMillis)
public void gradualWhiteOff()
public void gradualWhiteOff(int onLevel)
public void gradualWhiteOff(int stepSize, int sleepSpeedMillis)
public void gradualOff(int rgbColour)
public void gradualOff(int rgbColour, int stepSize, int sleepSpeedMillis)
public void gradualOn(int rgbColour, int onLevel, int stepSize, int sleepSpeedMillis)
public void gradualOff(int rgbColour, int onLevel, int stepSize, int sleepSpeedMillis)
public void cycleAllGradients(int numLoops)
public void cycleAllGradients(int numLoops, int onLevel)
public static void main(String[] args) throws InterruptedException
InterruptedException
public static boolean sleep(long waitTime)
waitTime
- the sleep time in milli seconds (ms).WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses