@MinDoc(copyright="Copyright 2021 A. Weinert", author="Albrecht Weinert", version="V.40", lastModified="19.04.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
A fifth program for Raspberry's GPIO pins Rev. 40 19.04.2021 Copyright (c) 2019 Albrecht Weinert
weinert-automation.de a-weinert.de It uses two/three pins as output assuming two LEDs connected to as H=on Pi 1 / Pi 3 Pin GPIO17/ 17 : red 11 GPIO21/ 27 : green 13 GPIO25 : yellow 22 (since Revision 45) This program forces application singleton and may be used as service. Its functions are the same as rdGnBlinkBlink (even sharing the lockFile) except for using the pigpioD library. Our makefiles define MCU and PLATFORM as make variables and macros. So we could make the GPIO pin and address assignment automatically in the C programmes. (End of original C comment excerpt)
ThePi
object either by a Pi3 (for Pi0, 3 and 4) or
Pi1 interface's inner class.TestOnPiPiUtil.Impl, PiUtil.LeTick| Modifier and Type | Field and Description |
|---|---|
String |
argHost |
int |
argPiType |
int |
argPort |
int |
argTimeout |
int |
ledGNpin
The LEDs to blink.
|
int |
ledRDpin
The LEDs to blink.
|
int |
ledYEpin
The LEDs to blink.
|
ano, appBase, appIO, appStartTime, appStartTimeMS, args, bgColor, err, fullClassName, help, icon, INIT_ERROR, JOB_DONE_OK, log, LOG_OUT_ERROR, MAIN_THREAD_EXC, mainThread, myClass, myFrame, name, NO_PARS_ERROR, out, outMode, packName, prop, retCode, runFlag, shortClassName, title, verbose, verbosityERR_ASSIGN_PIN, ERR_CLOSE_WDOG, ERR_NoGPIOLOCK, ERR_NoLOCKFILE, ERR_NoLOCKPROC, ERR_NOT_LOCKED, ERR_OPEN_W_DOG, ERR_PIGPIOD_CON, lckPiGpioPth, lckWinGpioPthGPIO_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_ALT5AUTHOR, 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, JAR_ENCODING, JH, JRL, M, NO_BYTES, NO_CLASSES, NO_DOUBLES, NO_OBJECTS, 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, UD, UL, UL_UR_da, UR, WEB_START_VERSILLEGAL_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 |
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).
|
Object |
getMessageComponent(int index)
Get a message component by its index.
|
int |
getMessageComponentsLength()
Number of messageFormat components of this application.
|
Integer |
getPiType()
Get the Pi type.
|
static void |
main(String[] args)
The application start.
|
boolean |
parsePartial()
Partial evaluation of start parameters by Prop.
|
void |
resetCycCount()
Reset the number of cycles counter.
|
void |
setCycCount(Integer cycCount)
Set the number of cycles.
|
actionPerformed, allowNoPropertiesFile, clientOrder, condHelpLog, connect, errMeld, errMeld, errorExit, errorExit, errorText, formMessage, formMessage, formMessage, getAbout, getAboutText, getActTime, getAppLogger, getAppStartTime, getArgs, getAuthor, getCopyright, getDbLogger, getExecTimeMs, getExecTimeMsL, getExecTimeString, getHelp, getHelpText, getIcon, getLanguage, getLogHandler, getMyFrame, getName, getNameWithVersDate, getOutMode, getProp, getPurpose, getStartTime, getStateString, getTheCloser, getTitle, getUsage, getVerbose, getVerbosity, getVersDate, getXMLinput, go, go, go, haveIcon, isDebug, isHelp, isHelpLog, isNormal, isRunFlag, isSilent, isTest, isVerbose, logVerbose, logVerbose, makeStatusTextEnd, makeStatusTextStart, messageFormat, normalExit, performeAction, queueAction, 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, wakeMainThreadclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcloseLock, closeWatchdog, eightDigitHex, errorText, getLastExcept, getLastExcMess, getLastLockFN, getOut, getUseLock, openLock, openWatchdog, setUseLock, systemExit, thrDelay, triggerWatchdog, twoDigitDecisWebStartstopgetActTime, getArgs, getCopyright, getExecTimeMsL, getLanguage, getName, getPurpose, getStartTime, getVerbose, getVersDate, stopretVtextpublic int ledRDpin
public int ledYEpin
public int ledGNpin
public int argPiType
public int argPort
public int argTimeout
public String argHost
public final boolean parsePartial()
AppProp object shall
evaluate and check the start parameters (see App.args) only
partially. For the meaning of "partial evaluation" please see
Prop#parse(String[],CharSequence,boolean)
Prop.parse(String[], CharSequence, boolean).Prop is a
fixed property of an application classes extending App must override this
method finally this methods default behaviour is not wanted.parsePartial in class AppApp.App(String[])public int getMessageComponentsLength()
AppgetMessageComponentsLength in interface TextHelper.MessageComponentsgetMessageComponentsLength in class AppApp.getMessageComponent(int)public Object getMessageComponent(int index)
App.getMessageComponent(int)ComVar.PROG_NAME program name like de.frame4j.ExecComVar.PROG_SHORT program short name like e.g. ExecComVar.HOST_NAME host's name if can be determinedComVar.OS operating system's nameComVar.ON_PI true when running on a PigetMessageComponent in interface TextHelper.MessageComponentsgetMessageComponent in class Appindex - Range 0 .. getMessageComponentsLength() - 1public Integer getCycCount()
RdGnPiGpioDBlinkMBeangetCycCount in interface RdGnPiGpioDBlinkMBeanRdGnPiGpioDBlinkMBean.resetCycCount()public void setCycCount(Integer cycCount)
RdGnPiGpioDBlinkMBeansetCycCount in interface RdGnPiGpioDBlinkMBeanpublic void resetCycCount()
RdGnPiGpioDBlinkMBeanresetCycCount in interface RdGnPiGpioDBlinkMBeanRdGnPiGpioDBlinkMBean.getCycCount()public Boolean getLEDye()
RdGnPiGpioDBlinkMBeangetLEDye in interface RdGnPiGpioDBlinkMBeanpublic Boolean getLEDgn()
RdGnPiGpioDBlinkMBeangetLEDgn in interface RdGnPiGpioDBlinkMBeanpublic Boolean getLEDrd()
RdGnPiGpioDBlinkMBeangetLEDrd in interface RdGnPiGpioDBlinkMBeanpublic Integer getPiType()
RdGnPiGpioDBlinkMBeangetPiType in interface RdGnPiGpioDBlinkMBeanpublic 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 AppProp,
App.go(String[]),
App.go(String[], String, CharSequence),
App.mainThread