@MinDoc(copyright="Copyright 2021 A. Weinert", version="V.56", lastModified="28.06.2021", usage="start as Java application (-? for help)", purpose="a Frame4J program to blink LEDs on a Pi via pigpioD") public class BlinkOnPi extends App implements PiUtil, BlinkOnPiMBean
Pi 1 / Pi 3 Pin GPIO17/ 17 : red 11 GPIO25 : yellow 22 GPIO21/ 27 : green 13Additionally, a Lo input on Pin
7
will set Pin 12
Hi.
Those Pins are a Lo active button and a buzzer in the trafficPi shield
(featuring also 12 LEDs as traffic lights on a cross road to play
with).-noButBuz
and the four (trafficPi) traffic light can be chosen
as LEDs by options -north -east -south
or -west
.java de.weAut.demos.BlinkOnPi -help [-en | -de]
-en
or -de
will
switch the program's (help) output to English respectively German if
the operating system tells otherwise.ThePi
object either by a Pi3
(for Pi0, 3 and 4),
Pi1
or Pi2
interface's inner class.BlinkOnPiMBean
,
TestOnPi
,
BlinkOnPiMBean
,
PiUtil
,
BlinkOnPi.properties,
Raspi4testPinsPiUtil.Impl, PiUtil.LeTick
Modifier and Type | Field and Description |
---|---|
int |
buttPin
The button pin.
|
int |
buzzPin
The buzzer.
|
int |
ledGNpin
A LED to blink.
|
int |
ledRDpin
A LED to blink.
|
int |
ledYEpin
A LED to blink.
|
ano, appBase, appIO, appStartTime, appStartTimeMS, args, argsOrig, bgColor, err, fullClassName, help, icon, log, mainThread, myClass, myFrame, name, out, outMode, packName, prop, retCode, runFlag, shortClassName, title, verbose, verbosity
ERR_ASSIGN_PIN, ERR_CLOSE_WDOG, ERR_NoGPIOLOCK, ERR_NoLOCKFILE, ERR_NoLOCKPROC, ERR_NOT_LOCKED, ERR_OPEN_W_DOG, ERR_PIGPIOD_CON, lckPiGpioPth, lckWinGpioPth
GPIO_INP, GPIO_OUT, GPIOmax, GPIOmin, GPIOutM, H1, HI, L0, LO, PI_PUD_DOWN, PI_PUD_DT, PI_PUD_KP, PI_PUD_OFF, PI_PUD_UP, PIN0, PIN00, PIN01, PIN02, PIN04, PIN06, PIN09, PIN0V, PIN1, PIN14, PIN17, PIN2, PIN20, PIN25, PIN3V, PIN4, PIN5V, PIN6, PIN9, PINig, PINix, PIO_ALT0, PIO_ALT1, PIO_ALT2, PIO_ALT3, PIO_ALT4, PIO_ALT5
AUTHOR, BLANK_STRING, cons, CONSOL_ENCODING, COPYRIGHT, D, D_NaN, D_NegInf, D_PosInf, EMPTY_INT_A, EMPTY_STRING, FILE_ENCODING, FRW_CLLD, FS, FSS, H, hasCons, HOST_IP, HOST_IPv4, HOST_NAME, INIT_ERROR, JAR_ENCODING, JH, JOB_DONE_OK, JRL, LOG_OUT_ERROR, M, MAIN_THREAD_EXC, NO_BYTES, NO_CLASSES, NO_DOUBLES, NO_OBJECTS, NO_PARS_ERROR, NO_STRINGS, NOT_WINDOWS, ON_PI, ONE_DAY, ONE_HOUR, ONE_LEAP_YEAR, ONE_MINUTE, ONE_SECOND, ONE_WEEK, ONE_YEAR, OS, PROG_NAME, PROG_SHORT, PS, RUNTIME, S, SHY, UD, UL, UL_UR_da, UR
ILLEGAL_TYPE, ILLEGAL_VALUE, NO_ATTRIBUTE, NO_KNOWN_ATTRIBUTE, NO_VALUE, OK, retVtext
Constructor and Description |
---|
BlinkOnPi() |
Modifier and Type | Method and Description |
---|---|
int |
doIt()
The application's work.
|
Integer |
getCycCount()
See the number of cycles.
|
Boolean |
getLeBut()
The state of the button.
|
Boolean |
getLeBuz()
The state of the buzzer.
|
Integer |
getLeBuzPWM()
The PWM state of the buzzer.
|
Boolean |
getLEDgn()
The state of the green LED(s).
|
Boolean |
getLEDrd()
The state of the red LED(s).
|
Boolean |
getLEDye()
The state of the yellow LED(s).
|
Integer |
getPiType()
Get the Pi type.
|
static void |
main(String[] args)
The application start.
|
void |
setCycCount(Integer cycCount)
Set the number of cycles.
|
void |
setLeBuz(Boolean on)
The state of the buzzer.
|
void |
setLeBuzPWM(Integer pwm)
Set buzzer output by PMM.
|
actionPerformed, allowNoPropertiesFile, clientOrder, condHelpLog, connect, errMeld, errMeld, errorExit, errorExit, errorText, extraPropertiesFile, formMessage, formMessage, formMessage, getAbout, getAboutText, getActTime, getAppLogger, getAppStartTime, getArgs, getAuthor, getCopyright, getDbLogger, getExecTimeMs, getExecTimeMsL, getExecTimeString, getHelp, getHelpText, getIcon, getLanguage, getLogHandler, getMessageComponent, getMessageComponentsLength, getMyFrame, getName, getNameWithVersDate, getOutMode, getProp, getPurpose, getStartTime, getStateString, getTheCloser, getTitle, getUsage, getVerbose, getVerbosity, getVersDate, go, go, go, haveIcon, isDebug, isHelp, isHelpLog, isNormal, isRunFlag, isSilent, isTest, isVerbose, logVerbose, logVerbose, makeStatusTextEnd, makeStatusTextStart, messageFormat, normalExit, parsePartial, performeAction, queueAction, regAsStdMBean, repExc, setAboutText, setAttribute, setAttribute, setAuthor, setBgColor, setCodePages, setCopyright, setHelp, setLogOut2, setName, setOutMode, setOutMode, setPurpose, setTitle, setUsage, setVerbose, setVerbose, setVerbosity, setVerbosity, setVersDate, stop, threeLineEndMsg, toString, twoLineEndMsg, twoLineStartMsg, valueLang, valueLang, wakeMainThread
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
argHost, argPiType, argPort, argTimeout, closeLock, closeWatchdog, eightDigitHex, errorText, getDelCnt, getLastExcept, getLastExcMess, getLastLockFN, getOut, getOvrCnt, getUseLock, openLock, openLockPi, openWatchdog, regAsStdMBean, repExc, setArgHost, setArgPiType, setArgPort, setArgTimeout, setUseLock, systemExit, thrDelay, triggerWatchdog, twoDigitDec
getActTime, getArgs, getCopyright, getExecTimeMsL, getLanguage, getName, getPurpose, getStartTime, getVerbose, getVersDate, stop
retVtext
public int ledRDpin
public int ledYEpin
public int ledGNpin
public int buzzPin
public int buttPin
public Integer getCycCount()
BlinkOnPiMBean
BlinkOnPi
it
would take more than 40 years to overflow to negative.getCycCount
in interface BlinkOnPiMBean
BlinkOnPiMBean.setCycCount(Integer)
public void setCycCount(Integer cycCount)
BlinkOnPiMBean
setCycCount
in interface BlinkOnPiMBean
BlinkOnPiMBean.getCycCount()
public Boolean getLEDye()
BlinkOnPiMBean
getLEDye
in interface BlinkOnPiMBean
public Boolean getLEDgn()
BlinkOnPiMBean
getLEDgn
in interface BlinkOnPiMBean
public Boolean getLEDrd()
BlinkOnPiMBean
getLEDrd
in interface BlinkOnPiMBean
public Boolean getLeBut()
BlinkOnPiMBean
getLeBut
in interface BlinkOnPiMBean
public Boolean getLeBuz()
BlinkOnPiMBean
getLeBuz
in interface BlinkOnPiMBean
BlinkOnPiMBean.setLeBuz(Boolean)
,
BlinkOnPiMBean.setLeBuzPWM(Integer)
,
BlinkOnPiMBean.getLeBuzPWM()
public void setLeBuz(Boolean on)
BlinkOnPiMBean
setLeBuz
in interface BlinkOnPiMBean
public void setLeBuzPWM(Integer pwm)
BlinkOnPiMBean
setLeBuzPWM
in interface BlinkOnPiMBean
pwm
- 0..255 is 0..100% PWMBlinkOnPiMBean.getLeBuzPWM()
,
BlinkOnPiMBean.getLeBuz()
public Integer getLeBuzPWM()
BlinkOnPiMBean
getLeBuzPWM
in interface BlinkOnPiMBean
BlinkOnPiMBean.getLeBuz()
public Integer getPiType()
BlinkOnPiMBean
getPiType
in interface BlinkOnPiMBean
public static void main(String[] args)
doIt()
).
Can be stopped by signal (cntlC), kill command and the like, as well as
by an MBean client, like e.g. JConsole, by operation App.stop()
.
Run by java BlinkOnPi [host [port]] [-option [-option ....-north 29 31 33; -east 36 38 40; -south 11 13 15; -west 16 18 22;
-LEDefault 11 22 13
-pi0 -pi1 -pi3 -pi4
(0, 1, 3 and 4 map to 3, the default)args
- start parameters.public int doIt()
doIt
in class App
Prop
,
App.go(String[])
,
App.go(String[], String, CharSequence)
,
App.mainThread