wpilib18/java/current/javadoc/edu/wpi/first/wpilibj/Counter.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_144) on Sat Oct 28 05:22:52 EDT 2017 -->
<title>Counter (Documentation - Release API)</title>
<meta name="date" content="2017-10-28">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Counter (Documentation - Release API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":10,"i26":10,"i27":10,"i28":10,"i29":10,"i30":10,"i31":10,"i32":10,"i33":10,"i34":10,"i35":10,"i36":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../edu/wpi/first/wpilibj/ControllerPower.html" title="class in edu.wpi.first.wpilibj"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../edu/wpi/first/wpilibj/Counter.Mode.html" title="enum in edu.wpi.first.wpilibj"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?edu/wpi/first/wpilibj/Counter.html" target="_top">Frames</a></li>
<li><a href="Counter.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested.class.summary">Nested</a> | </li>
<li><a href="#field.summary">Field</a> | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">edu.wpi.first.wpilibj</div>
<h2 title="Class Counter" class="title">Class Counter</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../../edu/wpi/first/wpilibj/SensorBase.html" title="class in edu.wpi.first.wpilibj">edu.wpi.first.wpilibj.SensorBase</a></li>
<li>
<ul class="inheritance">
<li>edu.wpi.first.wpilibj.Counter</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html" title="interface in edu.wpi.first.wpilibj">CounterBase</a>, <a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html" title="interface in edu.wpi.first.wpilibj.livewindow">LiveWindowSendable</a>, <a href="../../../../edu/wpi/first/wpilibj/PIDSource.html" title="interface in edu.wpi.first.wpilibj">PIDSource</a>, <a href="../../../../edu/wpi/first/wpilibj/Sendable.html" title="interface in edu.wpi.first.wpilibj">Sendable</a></dd>
</dl>
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><a href="../../../../edu/wpi/first/wpilibj/GearTooth.html" title="class in edu.wpi.first.wpilibj">GearTooth</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="typeNameLabel">Counter</span>
extends <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html" title="class in edu.wpi.first.wpilibj">SensorBase</a>
implements <a href="../../../../edu/wpi/first/wpilibj/CounterBase.html" title="interface in edu.wpi.first.wpilibj">CounterBase</a>, <a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html" title="interface in edu.wpi.first.wpilibj.livewindow">LiveWindowSendable</a>, <a href="../../../../edu/wpi/first/wpilibj/PIDSource.html" title="interface in edu.wpi.first.wpilibj">PIDSource</a></pre>
<div class="block">Class for counting the number of ticks on a digital input channel.
<p>This is a general purpose class for counting repetitive events. It can return the number of
counts, the period of the most recent cycle, and detect when the signal being counted has
stopped by supplying a maximum cycle time.
<p>All counters will immediately start counting - reset() them if you need them to be zeroed
before use.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption><span>Nested Classes</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.Mode.html" title="enum in edu.wpi.first.wpilibj">Counter.Mode</a></span></code>
<div class="block">Mode determines how and what the counter counts.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="nested.classes.inherited.from.class.edu.wpi.first.wpilibj.CounterBase">
<!-- -->
</a>
<h3>Nested classes/interfaces inherited from interface edu.wpi.first.wpilibj.<a href="../../../../edu/wpi/first/wpilibj/CounterBase.html" title="interface in edu.wpi.first.wpilibj">CounterBase</a></h3>
<code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.EncodingType.html" title="enum in edu.wpi.first.wpilibj">CounterBase.EncodingType</a></code></li>
</ul>
</li>
</ul>
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected <a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#m_downSource">m_downSource</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected <a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#m_upSource">m_upSource</a></span></code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="fields.inherited.from.class.edu.wpi.first.wpilibj.SensorBase">
<!-- -->
</a>
<h3>Fields inherited from class edu.wpi.first.wpilibj.<a href="../../../../edu/wpi/first/wpilibj/SensorBase.html" title="class in edu.wpi.first.wpilibj">SensorBase</a></h3>
<code><a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kAnalogInputChannels">kAnalogInputChannels</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kAnalogOutputChannels">kAnalogOutputChannels</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kDigitalChannels">kDigitalChannels</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kPCMModules">kPCMModules</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kPDPChannels">kPDPChannels</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kPDPModules">kPDPModules</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kPwmChannels">kPwmChannels</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kRelayChannels">kRelayChannels</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kSolenoidChannels">kSolenoidChannels</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#kSystemClockTicksPerMicrosecond">kSystemClockTicksPerMicrosecond</a></code></li>
</ul>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#Counter--">Counter</a></span>()</code>
<div class="block">Create an instance of a counter where no sources are selected.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#Counter-edu.wpi.first.wpilibj.AnalogTrigger-">Counter</a></span>(<a href="../../../../edu/wpi/first/wpilibj/AnalogTrigger.html" title="class in edu.wpi.first.wpilibj">AnalogTrigger</a> trigger)</code>
<div class="block">Create an instance of a Counter object.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#Counter-edu.wpi.first.wpilibj.Counter.Mode-">Counter</a></span>(<a href="../../../../edu/wpi/first/wpilibj/Counter.Mode.html" title="enum in edu.wpi.first.wpilibj">Counter.Mode</a> mode)</code>
<div class="block">Create an instance of a counter with the given mode.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#Counter-edu.wpi.first.wpilibj.CounterBase.EncodingType-edu.wpi.first.wpilibj.DigitalSource-edu.wpi.first.wpilibj.DigitalSource-boolean-">Counter</a></span>(<a href="../../../../edu/wpi/first/wpilibj/CounterBase.EncodingType.html" title="enum in edu.wpi.first.wpilibj">CounterBase.EncodingType</a> encodingType,
<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> upSource,
<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> downSource,
boolean inverted)</code>
<div class="block">Create an instance of a Counter object.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#Counter-edu.wpi.first.wpilibj.DigitalSource-">Counter</a></span>(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> source)</code>
<div class="block">Create an instance of a counter from a Digital Input.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#Counter-int-">Counter</a></span>(int channel)</code>
<div class="block">Create an instance of a Counter object.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#clearDownSource--">clearDownSource</a></span>()</code>
<div class="block">Disable the down counting source to the counter.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#clearUpSource--">clearUpSource</a></span>()</code>
<div class="block">Disable the up counting source to the counter.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#free--">free</a></span>()</code>
<div class="block">Free the resources used by this object.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#get--">get</a></span>()</code>
<div class="block">Read the current counter value.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#getDirection--">getDirection</a></span>()</code>
<div class="block">The last direction the counter value changed.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#getDistance--">getDistance</a></span>()</code>
<div class="block">Read the current scaled counter value.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#getFPGAIndex--">getFPGAIndex</a></span>()</code>
<div class="block">The counter's FPGA index.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#getPeriod--">getPeriod</a></span>()</code>
<div class="block">Get the Period of the most recent count.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code><a href="../../../../edu/wpi/first/wpilibj/PIDSourceType.html" title="enum in edu.wpi.first.wpilibj">PIDSourceType</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#getPIDSourceType--">getPIDSourceType</a></span>()</code>
<div class="block">Get which parameter of the device you are using as a process control variable.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#getRate--">getRate</a></span>()</code>
<div class="block">Get the current rate of the Counter.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#getSamplesToAverage--">getSamplesToAverage</a></span>()</code>
<div class="block">Get the Samples to Average which specifies the number of samples of the timer to average when
calculating the period.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#getSmartDashboardType--">getSmartDashboardType</a></span>()</code>
<div class="block">The string representation of the named data type that will be used by the smart dashboard for
this <a href="../../../../edu/wpi/first/wpilibj/Sendable.html" title="interface in edu.wpi.first.wpilibj"><code>Sendable</code></a>.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#getStopped--">getStopped</a></span>()</code>
<div class="block">Determine if the clock is stopped.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#initTable-edu.wpi.first.networktables.NetworkTable-">initTable</a></span>(<a href="../../../../edu/wpi/first/networktables/NetworkTable.html" title="class in edu.wpi.first.networktables">NetworkTable</a> subtable)</code>
<div class="block">Initializes a table for this <a href="../../../../edu/wpi/first/wpilibj/Sendable.html" title="interface in edu.wpi.first.wpilibj"><code>Sendable</code></a> object.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#pidGet--">pidGet</a></span>()</code>
<div class="block">Get the result to use in PIDController.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#reset--">reset</a></span>()</code>
<div class="block">Reset the Counter to zero.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#setDistancePerPulse-double-">setDistancePerPulse</a></span>(double distancePerPulse)</code>
<div class="block">Set the distance per pulse for this counter.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#setDownSource-edu.wpi.first.wpilibj.AnalogTrigger-edu.wpi.first.wpilibj.AnalogTriggerOutput.AnalogTriggerType-">setDownSource</a></span>(<a href="../../../../edu/wpi/first/wpilibj/AnalogTrigger.html" title="class in edu.wpi.first.wpilibj">AnalogTrigger</a> analogTrigger,
<a href="../../../../edu/wpi/first/wpilibj/AnalogTriggerOutput.AnalogTriggerType.html" title="enum in edu.wpi.first.wpilibj">AnalogTriggerOutput.AnalogTriggerType</a> triggerType)</code>
<div class="block">Set the down counting source to be an analog trigger.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#setDownSource-edu.wpi.first.wpilibj.DigitalSource-">setDownSource</a></span>(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> source)</code>
<div class="block">Set the source object that causes the counter to count down.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#setDownSource-int-">setDownSource</a></span>(int channel)</code>
<div class="block">Set the down counting source to be a digital input channel.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#setDownSourceEdge-boolean-boolean-">setDownSourceEdge</a></span>(boolean risingEdge,
boolean fallingEdge)</code>
<div class="block">Set the edge sensitivity on a down counting source.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#setExternalDirectionMode--">setExternalDirectionMode</a></span>()</code>
<div class="block">Set external direction mode on this counter.</div>
</td>
</tr>
<tr id="i22" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#setMaxPeriod-double-">setMaxPeriod</a></span>(double maxPeriod)</code>
<div class="block">Set the maximum period where the device is still considered "moving".</div>
</td>
</tr>
<tr id="i23" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#setPIDSourceType-edu.wpi.first.wpilibj.PIDSourceType-">setPIDSourceType</a></span>(<a href="../../../../edu/wpi/first/wpilibj/PIDSourceType.html" title="enum in edu.wpi.first.wpilibj">PIDSourceType</a> pidSource)</code>
<div class="block">Set which parameter of the encoder you are using as a process control variable.</div>
</td>
</tr>
<tr id="i24" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#setPulseLengthMode-double-">setPulseLengthMode</a></span>(double threshold)</code>
<div class="block">Configure the counter to count in up or down based on the length of the input pulse.</div>
</td>
</tr>
<tr id="i25" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#setReverseDirection-boolean-">setReverseDirection</a></span>(boolean reverseDirection)</code>
<div class="block">Set the Counter to return reversed sensing on the direction.</div>
</td>
</tr>
<tr id="i26" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#setSamplesToAverage-int-">setSamplesToAverage</a></span>(int samplesToAverage)</code>
<div class="block">Set the Samples to Average which specifies the number of samples of the timer to average when
calculating the period.</div>
</td>
</tr>
<tr id="i27" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#setSemiPeriodMode-boolean-">setSemiPeriodMode</a></span>(boolean highSemiPeriod)</code>
<div class="block">Set Semi-period mode on this counter.</div>
</td>
</tr>
<tr id="i28" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#setUpdateWhenEmpty-boolean-">setUpdateWhenEmpty</a></span>(boolean enabled)</code>
<div class="block">Select whether you want to continue updating the event timer output when there are no samples
captured.</div>
</td>
</tr>
<tr id="i29" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#setUpDownCounterMode--">setUpDownCounterMode</a></span>()</code>
<div class="block">Set standard up / down counting mode on this counter.</div>
</td>
</tr>
<tr id="i30" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#setUpSource-edu.wpi.first.wpilibj.AnalogTrigger-edu.wpi.first.wpilibj.AnalogTriggerOutput.AnalogTriggerType-">setUpSource</a></span>(<a href="../../../../edu/wpi/first/wpilibj/AnalogTrigger.html" title="class in edu.wpi.first.wpilibj">AnalogTrigger</a> analogTrigger,
<a href="../../../../edu/wpi/first/wpilibj/AnalogTriggerOutput.AnalogTriggerType.html" title="enum in edu.wpi.first.wpilibj">AnalogTriggerOutput.AnalogTriggerType</a> triggerType)</code>
<div class="block">Set the up counting source to be an analog trigger.</div>
</td>
</tr>
<tr id="i31" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#setUpSource-edu.wpi.first.wpilibj.DigitalSource-">setUpSource</a></span>(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> source)</code>
<div class="block">Set the source object that causes the counter to count up.</div>
</td>
</tr>
<tr id="i32" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#setUpSource-int-">setUpSource</a></span>(int channel)</code>
<div class="block">Set the upsource for the counter as a digital input channel.</div>
</td>
</tr>
<tr id="i33" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#setUpSourceEdge-boolean-boolean-">setUpSourceEdge</a></span>(boolean risingEdge,
boolean fallingEdge)</code>
<div class="block">Set the edge sensitivity on an up counting source.</div>
</td>
</tr>
<tr id="i34" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#startLiveWindowMode--">startLiveWindowMode</a></span>()</code>
<div class="block">Start having this sendable object automatically respond to value changes reflect the value on
the table.</div>
</td>
</tr>
<tr id="i35" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#stopLiveWindowMode--">stopLiveWindowMode</a></span>()</code>
<div class="block">Stop having this sendable object automatically respond to value changes.</div>
</td>
</tr>
<tr id="i36" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/wpi/first/wpilibj/Counter.html#updateTable--">updateTable</a></span>()</code>
<div class="block">Update the table for this sendable object with the latest values.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.edu.wpi.first.wpilibj.SensorBase">
<!-- -->
</a>
<h3>Methods inherited from class edu.wpi.first.wpilibj.<a href="../../../../edu/wpi/first/wpilibj/SensorBase.html" title="class in edu.wpi.first.wpilibj">SensorBase</a></h3>
<code><a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#checkAnalogInputChannel-int-">checkAnalogInputChannel</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#checkAnalogOutputChannel-int-">checkAnalogOutputChannel</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#checkDigitalChannel-int-">checkDigitalChannel</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#checkPDPChannel-int-">checkPDPChannel</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#checkPDPModule-int-">checkPDPModule</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#checkPWMChannel-int-">checkPWMChannel</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#checkRelayChannel-int-">checkRelayChannel</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#checkSolenoidChannel-int-">checkSolenoidChannel</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#checkSolenoidModule-int-">checkSolenoidModule</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#getDefaultSolenoidModule--">getDefaultSolenoidModule</a>, <a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#setDefaultSolenoidModule-int-">setDefaultSolenoidModule</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="m_upSource">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_upSource</h4>
<pre>protected <a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> m_upSource</pre>
</li>
</ul>
<a name="m_downSource">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>m_downSource</h4>
<pre>protected <a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> m_downSource</pre>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="Counter-edu.wpi.first.wpilibj.Counter.Mode-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Counter</h4>
<pre>public Counter(<a href="../../../../edu/wpi/first/wpilibj/Counter.Mode.html" title="enum in edu.wpi.first.wpilibj">Counter.Mode</a> mode)</pre>
<div class="block">Create an instance of a counter with the given mode.</div>
</li>
</ul>
<a name="Counter--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Counter</h4>
<pre>public Counter()</pre>
<div class="block">Create an instance of a counter where no sources are selected. Then they all must be selected
by calling functions to specify the upsource and the downsource independently.
<p>The counter will start counting immediately.</div>
</li>
</ul>
<a name="Counter-edu.wpi.first.wpilibj.DigitalSource-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Counter</h4>
<pre>public Counter(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> source)</pre>
<div class="block">Create an instance of a counter from a Digital Input. This is used if an existing digital input
is to be shared by multiple other objects such as encoders or if the Digital Source is not a
DIO channel (such as an Analog Trigger)
<p>The counter will start counting immediately.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>source</code> - the digital source to count</dd>
</dl>
</li>
</ul>
<a name="Counter-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Counter</h4>
<pre>public Counter(int channel)</pre>
<div class="block">Create an instance of a Counter object. Create an up-Counter instance given a channel.
<p>The counter will start counting immediately.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>channel</code> - the DIO channel to use as the up source. 0-9 are on-board, 10-25 are on the MXP</dd>
</dl>
</li>
</ul>
<a name="Counter-edu.wpi.first.wpilibj.CounterBase.EncodingType-edu.wpi.first.wpilibj.DigitalSource-edu.wpi.first.wpilibj.DigitalSource-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Counter</h4>
<pre>public Counter(<a href="../../../../edu/wpi/first/wpilibj/CounterBase.EncodingType.html" title="enum in edu.wpi.first.wpilibj">CounterBase.EncodingType</a> encodingType,
<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> upSource,
<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> downSource,
boolean inverted)</pre>
<div class="block">Create an instance of a Counter object. Create an instance of a simple up-Counter given an
analog trigger. Use the trigger state output from the analog trigger.
<p>The counter will start counting immediately.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>encodingType</code> - which edges to count</dd>
<dd><code>upSource</code> - first source to count</dd>
<dd><code>downSource</code> - second source for direction</dd>
<dd><code>inverted</code> - true to invert the count</dd>
</dl>
</li>
</ul>
<a name="Counter-edu.wpi.first.wpilibj.AnalogTrigger-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>Counter</h4>
<pre>public Counter(<a href="../../../../edu/wpi/first/wpilibj/AnalogTrigger.html" title="class in edu.wpi.first.wpilibj">AnalogTrigger</a> trigger)</pre>
<div class="block">Create an instance of a Counter object. Create an instance of a simple up-Counter given an
analog trigger. Use the trigger state output from the analog trigger.
<p>The counter will start counting immediately.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>trigger</code> - the analog trigger to count</dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="free--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>free</h4>
<pre>public void free()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#free--">SensorBase</a></code></span></div>
<div class="block">Free the resources used by this object.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/SensorBase.html#free--">free</a></code> in class <code><a href="../../../../edu/wpi/first/wpilibj/SensorBase.html" title="class in edu.wpi.first.wpilibj">SensorBase</a></code></dd>
</dl>
</li>
</ul>
<a name="getFPGAIndex--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getFPGAIndex</h4>
<pre>public int getFPGAIndex()</pre>
<div class="block">The counter's FPGA index.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the Counter's FPGA index</dd>
</dl>
</li>
</ul>
<a name="setUpSource-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setUpSource</h4>
<pre>public void setUpSource(int channel)</pre>
<div class="block">Set the upsource for the counter as a digital input channel.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>channel</code> - the DIO channel to count 0-9 are on-board, 10-25 are on the MXP</dd>
</dl>
</li>
</ul>
<a name="setUpSource-edu.wpi.first.wpilibj.DigitalSource-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setUpSource</h4>
<pre>public void setUpSource(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> source)</pre>
<div class="block">Set the source object that causes the counter to count up. Set the up counting DigitalSource.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>source</code> - the digital source to count</dd>
</dl>
</li>
</ul>
<a name="setUpSource-edu.wpi.first.wpilibj.AnalogTrigger-edu.wpi.first.wpilibj.AnalogTriggerOutput.AnalogTriggerType-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setUpSource</h4>
<pre>public void setUpSource(<a href="../../../../edu/wpi/first/wpilibj/AnalogTrigger.html" title="class in edu.wpi.first.wpilibj">AnalogTrigger</a> analogTrigger,
<a href="../../../../edu/wpi/first/wpilibj/AnalogTriggerOutput.AnalogTriggerType.html" title="enum in edu.wpi.first.wpilibj">AnalogTriggerOutput.AnalogTriggerType</a> triggerType)</pre>
<div class="block">Set the up counting source to be an analog trigger.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>analogTrigger</code> - The analog trigger object that is used for the Up Source</dd>
<dd><code>triggerType</code> - The analog trigger output that will trigger the counter.</dd>
</dl>
</li>
</ul>
<a name="setUpSourceEdge-boolean-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setUpSourceEdge</h4>
<pre>public void setUpSourceEdge(boolean risingEdge,
boolean fallingEdge)</pre>
<div class="block">Set the edge sensitivity on an up counting source. Set the up source to either detect rising
edges or falling edges.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>risingEdge</code> - true to count rising edge</dd>
<dd><code>fallingEdge</code> - true to count falling edge</dd>
</dl>
</li>
</ul>
<a name="clearUpSource--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>clearUpSource</h4>
<pre>public void clearUpSource()</pre>
<div class="block">Disable the up counting source to the counter.</div>
</li>
</ul>
<a name="setDownSource-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setDownSource</h4>
<pre>public void setDownSource(int channel)</pre>
<div class="block">Set the down counting source to be a digital input channel.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>channel</code> - the DIO channel to count 0-9 are on-board, 10-25 are on the MXP</dd>
</dl>
</li>
</ul>
<a name="setDownSource-edu.wpi.first.wpilibj.DigitalSource-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setDownSource</h4>
<pre>public void setDownSource(<a href="../../../../edu/wpi/first/wpilibj/DigitalSource.html" title="class in edu.wpi.first.wpilibj">DigitalSource</a> source)</pre>
<div class="block">Set the source object that causes the counter to count down. Set the down counting
DigitalSource.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>source</code> - the digital source to count</dd>
</dl>
</li>
</ul>
<a name="setDownSource-edu.wpi.first.wpilibj.AnalogTrigger-edu.wpi.first.wpilibj.AnalogTriggerOutput.AnalogTriggerType-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setDownSource</h4>
<pre>public void setDownSource(<a href="../../../../edu/wpi/first/wpilibj/AnalogTrigger.html" title="class in edu.wpi.first.wpilibj">AnalogTrigger</a> analogTrigger,
<a href="../../../../edu/wpi/first/wpilibj/AnalogTriggerOutput.AnalogTriggerType.html" title="enum in edu.wpi.first.wpilibj">AnalogTriggerOutput.AnalogTriggerType</a> triggerType)</pre>
<div class="block">Set the down counting source to be an analog trigger.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>analogTrigger</code> - The analog trigger object that is used for the Down Source</dd>
<dd><code>triggerType</code> - The analog trigger output that will trigger the counter.</dd>
</dl>
</li>
</ul>
<a name="setDownSourceEdge-boolean-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setDownSourceEdge</h4>
<pre>public void setDownSourceEdge(boolean risingEdge,
boolean fallingEdge)</pre>
<div class="block">Set the edge sensitivity on a down counting source. Set the down source to either detect rising
edges or falling edges.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>risingEdge</code> - true to count the rising edge</dd>
<dd><code>fallingEdge</code> - true to count the falling edge</dd>
</dl>
</li>
</ul>
<a name="clearDownSource--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>clearDownSource</h4>
<pre>public void clearDownSource()</pre>
<div class="block">Disable the down counting source to the counter.</div>
</li>
</ul>
<a name="setUpDownCounterMode--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setUpDownCounterMode</h4>
<pre>public void setUpDownCounterMode()</pre>
<div class="block">Set standard up / down counting mode on this counter. Up and down counts are sourced
independently from two inputs.</div>
</li>
</ul>
<a name="setExternalDirectionMode--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setExternalDirectionMode</h4>
<pre>public void setExternalDirectionMode()</pre>
<div class="block">Set external direction mode on this counter. Counts are sourced on the Up counter input. The
Down counter input represents the direction to count.</div>
</li>
</ul>
<a name="setSemiPeriodMode-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setSemiPeriodMode</h4>
<pre>public void setSemiPeriodMode(boolean highSemiPeriod)</pre>
<div class="block">Set Semi-period mode on this counter. Counts up on both rising and falling edges.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>highSemiPeriod</code> - true to count up on both rising and falling</dd>
</dl>
</li>
</ul>
<a name="setPulseLengthMode-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setPulseLengthMode</h4>
<pre>public void setPulseLengthMode(double threshold)</pre>
<div class="block">Configure the counter to count in up or down based on the length of the input pulse. This mode
is most useful for direction sensitive gear tooth sensors.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>threshold</code> - The pulse length beyond which the counter counts the opposite direction. Units
are seconds.</dd>
</dl>
</li>
</ul>
<a name="get--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>get</h4>
<pre>public int get()</pre>
<div class="block">Read the current counter value. Read the value at this instant. It may still be running, so it
reflects the current value. Next time it is read, it might have a different value.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html#get--">get</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html" title="interface in edu.wpi.first.wpilibj">CounterBase</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the count</dd>
</dl>
</li>
</ul>
<a name="getDistance--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDistance</h4>
<pre>public double getDistance()</pre>
<div class="block">Read the current scaled counter value. Read the value at this instant, scaled by the distance
per pulse (defaults to 1).</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The distance since the last reset</dd>
</dl>
</li>
</ul>
<a name="reset--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>reset</h4>
<pre>public void reset()</pre>
<div class="block">Reset the Counter to zero. Set the counter value to zero. This doesn't effect the running state
of the counter, just sets the current value to zero.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html#reset--">reset</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html" title="interface in edu.wpi.first.wpilibj">CounterBase</a></code></dd>
</dl>
</li>
</ul>
<a name="setMaxPeriod-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setMaxPeriod</h4>
<pre>public void setMaxPeriod(double maxPeriod)</pre>
<div class="block">Set the maximum period where the device is still considered "moving". Sets the maximum period
where the device is considered moving. This value is used to determine the "stopped" state of
the counter using the GetStopped method.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html#setMaxPeriod-double-">setMaxPeriod</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html" title="interface in edu.wpi.first.wpilibj">CounterBase</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>maxPeriod</code> - The maximum period where the counted device is considered moving in seconds.</dd>
</dl>
</li>
</ul>
<a name="setUpdateWhenEmpty-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setUpdateWhenEmpty</h4>
<pre>public void setUpdateWhenEmpty(boolean enabled)</pre>
<div class="block">Select whether you want to continue updating the event timer output when there are no samples
captured. The output of the event timer has a buffer of periods that are averaged and posted to
a register on the FPGA. When the timer detects that the event source has stopped (based on the
MaxPeriod) the buffer of samples to be averaged is emptied. If you enable the update when
empty, you will be notified of the stopped source and the event time will report 0 samples. If
you disable update when empty, the most recent average will remain on the output until a new
sample is acquired. You will never see 0 samples output (except when there have been no events
since an FPGA reset) and you will likely not see the stopped bit become true (since it is
updated at the end of an average and there are no samples to average).</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>enabled</code> - true to continue updating</dd>
</dl>
</li>
</ul>
<a name="getStopped--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getStopped</h4>
<pre>public boolean getStopped()</pre>
<div class="block">Determine if the clock is stopped. Determine if the clocked input is stopped based on the
MaxPeriod value set using the SetMaxPeriod method. If the clock exceeds the MaxPeriod, then the
device (and counter) are assumed to be stopped and it returns true.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html#getStopped--">getStopped</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html" title="interface in edu.wpi.first.wpilibj">CounterBase</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if the most recent counter period exceeds the MaxPeriod value set by SetMaxPeriod.</dd>
</dl>
</li>
</ul>
<a name="getDirection--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDirection</h4>
<pre>public boolean getDirection()</pre>
<div class="block">The last direction the counter value changed.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html#getDirection--">getDirection</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html" title="interface in edu.wpi.first.wpilibj">CounterBase</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The last direction the counter value changed.</dd>
</dl>
</li>
</ul>
<a name="setReverseDirection-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setReverseDirection</h4>
<pre>public void setReverseDirection(boolean reverseDirection)</pre>
<div class="block">Set the Counter to return reversed sensing on the direction. This allows counters to change the
direction they are counting in the case of 1X and 2X quadrature encoding only. Any other
counter mode isn't supported.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>reverseDirection</code> - true if the value counted should be negated.</dd>
</dl>
</li>
</ul>
<a name="getPeriod--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPeriod</h4>
<pre>public double getPeriod()</pre>
<div class="block">Get the Period of the most recent count. Returns the time interval of the most recent count.
This can be used for velocity calculations to determine shaft speed.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html#getPeriod--">getPeriod</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/CounterBase.html" title="interface in edu.wpi.first.wpilibj">CounterBase</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The period of the last two pulses in units of seconds.</dd>
</dl>
</li>
</ul>
<a name="getRate--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getRate</h4>
<pre>public double getRate()</pre>
<div class="block">Get the current rate of the Counter. Read the current rate of the counter accounting for the
distance per pulse value. The default value for distance per pulse (1) yields units of pulses
per second.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The rate in units/sec</dd>
</dl>
</li>
</ul>
<a name="setSamplesToAverage-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setSamplesToAverage</h4>
<pre>public void setSamplesToAverage(int samplesToAverage)</pre>
<div class="block">Set the Samples to Average which specifies the number of samples of the timer to average when
calculating the period. Perform averaging to account for mechanical imperfections or as
oversampling to increase resolution.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>samplesToAverage</code> - The number of samples to average from 1 to 127.</dd>
</dl>
</li>
</ul>
<a name="getSamplesToAverage--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSamplesToAverage</h4>
<pre>public int getSamplesToAverage()</pre>
<div class="block">Get the Samples to Average which specifies the number of samples of the timer to average when
calculating the period. Perform averaging to account for mechanical imperfections or as
oversampling to increase resolution.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>SamplesToAverage The number of samples being averaged (from 1 to 127)</dd>
</dl>
</li>
</ul>
<a name="setDistancePerPulse-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setDistancePerPulse</h4>
<pre>public void setDistancePerPulse(double distancePerPulse)</pre>
<div class="block">Set the distance per pulse for this counter. This sets the multiplier used to determine the
distance driven based on the count value from the encoder. Set this value based on the Pulses
per Revolution and factor in any gearing reductions. This distance can be in any units you
like, linear or angular.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>distancePerPulse</code> - The scale factor that will be used to convert pulses to useful units.</dd>
</dl>
</li>
</ul>
<a name="setPIDSourceType-edu.wpi.first.wpilibj.PIDSourceType-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setPIDSourceType</h4>
<pre>public void setPIDSourceType(<a href="../../../../edu/wpi/first/wpilibj/PIDSourceType.html" title="enum in edu.wpi.first.wpilibj">PIDSourceType</a> pidSource)</pre>
<div class="block">Set which parameter of the encoder you are using as a process control variable. The counter
class supports the rate and distance parameters.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/PIDSource.html#setPIDSourceType-edu.wpi.first.wpilibj.PIDSourceType-">setPIDSourceType</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/PIDSource.html" title="interface in edu.wpi.first.wpilibj">PIDSource</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>pidSource</code> - An enum to select the parameter.</dd>
</dl>
</li>
</ul>
<a name="getPIDSourceType--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPIDSourceType</h4>
<pre>public <a href="../../../../edu/wpi/first/wpilibj/PIDSourceType.html" title="enum in edu.wpi.first.wpilibj">PIDSourceType</a> getPIDSourceType()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../edu/wpi/first/wpilibj/PIDSource.html#getPIDSourceType--">PIDSource</a></code></span></div>
<div class="block">Get which parameter of the device you are using as a process control variable.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/PIDSource.html#getPIDSourceType--">getPIDSourceType</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/PIDSource.html" title="interface in edu.wpi.first.wpilibj">PIDSource</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the currently selected PID source parameter</dd>
</dl>
</li>
</ul>
<a name="pidGet--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>pidGet</h4>
<pre>public double pidGet()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../edu/wpi/first/wpilibj/PIDSource.html#pidGet--">PIDSource</a></code></span></div>
<div class="block">Get the result to use in PIDController.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/PIDSource.html#pidGet--">pidGet</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/PIDSource.html" title="interface in edu.wpi.first.wpilibj">PIDSource</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the result to use in PIDController</dd>
</dl>
</li>
</ul>
<a name="getSmartDashboardType--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSmartDashboardType</h4>
<pre>public java.lang.String getSmartDashboardType()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../edu/wpi/first/wpilibj/Sendable.html#getSmartDashboardType--">Sendable</a></code></span></div>
<div class="block">The string representation of the named data type that will be used by the smart dashboard for
this <a href="../../../../edu/wpi/first/wpilibj/Sendable.html" title="interface in edu.wpi.first.wpilibj"><code>Sendable</code></a>.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/Sendable.html#getSmartDashboardType--">getSmartDashboardType</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/Sendable.html" title="interface in edu.wpi.first.wpilibj">Sendable</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The type of this <a href="../../../../edu/wpi/first/wpilibj/Sendable.html" title="interface in edu.wpi.first.wpilibj"><code>Sendable</code></a>.</dd>
</dl>
</li>
</ul>
<a name="initTable-edu.wpi.first.networktables.NetworkTable-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>initTable</h4>
<pre>public void initTable(<a href="../../../../edu/wpi/first/networktables/NetworkTable.html" title="class in edu.wpi.first.networktables">NetworkTable</a> subtable)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../edu/wpi/first/wpilibj/Sendable.html#initTable-edu.wpi.first.networktables.NetworkTable-">Sendable</a></code></span></div>
<div class="block">Initializes a table for this <a href="../../../../edu/wpi/first/wpilibj/Sendable.html" title="interface in edu.wpi.first.wpilibj"><code>Sendable</code></a> object.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/Sendable.html#initTable-edu.wpi.first.networktables.NetworkTable-">initTable</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/Sendable.html" title="interface in edu.wpi.first.wpilibj">Sendable</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>subtable</code> - The table to put the values in.</dd>
</dl>
</li>
</ul>
<a name="updateTable--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>updateTable</h4>
<pre>public void updateTable()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html#updateTable--">LiveWindowSendable</a></code></span></div>
<div class="block">Update the table for this sendable object with the latest values.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html#updateTable--">updateTable</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html" title="interface in edu.wpi.first.wpilibj.livewindow">LiveWindowSendable</a></code></dd>
</dl>
</li>
</ul>
<a name="startLiveWindowMode--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>startLiveWindowMode</h4>
<pre>public void startLiveWindowMode()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html#startLiveWindowMode--">LiveWindowSendable</a></code></span></div>
<div class="block">Start having this sendable object automatically respond to value changes reflect the value on
the table.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html#startLiveWindowMode--">startLiveWindowMode</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html" title="interface in edu.wpi.first.wpilibj.livewindow">LiveWindowSendable</a></code></dd>
</dl>
</li>
</ul>
<a name="stopLiveWindowMode--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>stopLiveWindowMode</h4>
<pre>public void stopLiveWindowMode()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html#stopLiveWindowMode--">LiveWindowSendable</a></code></span></div>
<div class="block">Stop having this sendable object automatically respond to value changes.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html#stopLiveWindowMode--">stopLiveWindowMode</a></code> in interface <code><a href="../../../../edu/wpi/first/wpilibj/livewindow/LiveWindowSendable.html" title="interface in edu.wpi.first.wpilibj.livewindow">LiveWindowSendable</a></code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../edu/wpi/first/wpilibj/ControllerPower.html" title="class in edu.wpi.first.wpilibj"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../edu/wpi/first/wpilibj/Counter.Mode.html" title="enum in edu.wpi.first.wpilibj"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?edu/wpi/first/wpilibj/Counter.html" target="_top">Frames</a></li>
<li><a href="Counter.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested.class.summary">Nested</a> | </li>
<li><a href="#field.summary">Field</a> | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>