From: Bob J. <jac...@us...> - 2004-08-31 09:43:34
|
Update of /cvsroot/jmri/scripts/jython In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17880 Added Files: MemorySiglet.py Log Message: adding a Memory example --- NEW FILE: MemorySiglet.py --- # This is an example script for a JMRI "Siglet" in Python # # It listens to a Memory object, and prints the new state to stdout # # The next line is maintained by CVS, please don't change it # $Revision: 1.1 $ import jarray import jmri class MemorySiglet(jmri.jmrit.automat.Siglet) : # init() is called exactly once at the beginning to do # any necessary configuration. def defineIO(self): # get the sensor and throttle objects self.mem = memories.provideMemory("12") # Register the inputs so setOutput will be called when needed. # Note that the output si35 should _not_ in included as an input. self.setInputs(jarray.array([self.mem], jmri.NamedBean)) return # handle() is called repeatedly until it returns false. # # Modify this to do your calculation. def setOuput(self): # this example doesn't actually do anything # and continue around again return 1 # to continue # end of class definition # create one of these a = MemorySiglet() # set the name, as a example of configuring it a.setName("MemorySiglet example script") # and start it running a.start() |