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. Sensors are created and managed in the Sensor Table.
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, JMRI lets you 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 on Panels).
The change takes effect immediately, unless a debounce timer is configured, 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.
The Sensor State column can be displayed either as text or as icons. This can be set as a global preferences via a display setting in the main Preferences menu under Display.
Sensors are kept in your layout configuration, along with Turnouts, Lights, Signal Heads, control panel setup etc. To store this information on disk, allowing you to reload it the next time you run JMRI, see Loading and Storing Your Work.
To create a new Sensor, follow this procedure:
For additional information about working with the Sensor Table, click here.
Below the table are check boxes to display additional columns with sensor control information.
The Defaults pulldown menu on the window menu bar allows you to set two system-wide settings:
The Sensor Debounce Delay helps prevent false triggers of a Sensor being passed into the
system and triggering other events in the system.
Such false triggers could be due to a dirty piece of track or electrical interference.
You can assign a delay in milliseconds before any sensor change is registered with the
rest of the system. If after that period the state has not changed compared to the original
state, the Sensor state will be passed onto the rest of the system.
However if the Sensor's state is different after the delay has passed, then the system will
restart the process, this time after the timer has finished it will check to see if the
sensor state is in the same state as it was before it restarted the process. If not the
process is re-started again until the state is the same before and after the delay has
passed.
A Sensor Group is a group of sensors of which at most one can be active at a time. When one member of the group becomes active, all others are set to inactive.
Sensor Groups are configured via the Sensor Group Tool.