JMRI: Sensor Documentation
What are Sensors?
A Sensor is JMRI's way of representing an input from the layout.
JMRI uses a Sensor to represent the status of a block occupancy detector, or a pushbutton on the fascia, or just about anything else you can attach to an input on your DCC or C/MRI system.
Controlling a Sensor
Generally, you don't control the state of a Sensor object; JMRI, working with the hardware on your layout, does.
But there are some occasions where you might like to locally change the state of a Sensor: To debug some logic that uses the Sensor as an input, etc. It can be very convenient to temporarily change how a sensor is set without having to run out to the layout and push a button or put a locomotive in a block.
Therefore, we let you locally change a sensor via the Sensor Table (see below), or by clicking on a sensor icon on a panel (See the PanelPro pages for more info on panels).
The change takes effect immediately, but only lasts until the next time you change it in the program, or the next time the input hardware on the layout changes the value.
Saving Sensor configuration to disk
Sensors are saved in your layout configuration file, along with turnouts,
lights, signal heads, etc. To store this information on disk, use Store
Configuration... in the File menu at the top of the Light
Table (or other tables from the Tools menu), or select Store Panel...
in the Panel menu.
Adding a new Sensor
To create a new Sensor, follow this procedure:
Click Sensor Table in the Tools menu to bring up the Sensor Table, and click the Add... button at the bottom of the table to bring up the Add/Edit Sensor window.
Enter a system name, according to the JMRI convention. The first letter designates your hardware system ('L' for loconet, 'C" for C/MRI, etc.), and the second letter must be 'S' for Sensor. These are followed by a number that gives the hardware address of the input connection being referenced. Examples of valid system addresses are: CS1004, and LS401, assuming you have C/MRI or Loconet hardware respectively; there are lots of other systems supported.
Enter a user name. Any string of characters that is different from the user name of other Sensors will be accepted, but it's wise to use a string that describes the intended use of the Sensor. You can leave this blank if you'd like.
Click the Create button at the bottom of the window. If everything is fine, a message stating "New Sensor added ... " will be displayed in the notes area. If there is trouble with anything, an error or warning message will be displayed in the notes area; you should then correct the error and click Create again.
Back in the main Sensor Table, you can then see the current status of the Sensor.