307 lines
13 KiB
HTML
307 lines
13 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<!--NewPage-->
|
|
<HTML>
|
|
<HEAD>
|
|
<!-- Generated by javadoc (build 1.6.0_29) on Mon Nov 28 00:50:34 PST 2011 -->
|
|
<TITLE>
|
|
DigitalInput
|
|
</TITLE>
|
|
|
|
<META NAME="date" CONTENT="2011-11-28">
|
|
|
|
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
|
|
|
|
<SCRIPT type="text/javascript">
|
|
function windowTitle()
|
|
{
|
|
if (location.href.indexOf('is-external=true') == -1) {
|
|
parent.document.title="DigitalInput";
|
|
}
|
|
}
|
|
</SCRIPT>
|
|
<NOSCRIPT>
|
|
</NOSCRIPT>
|
|
|
|
</HEAD>
|
|
|
|
<BODY BGCOLOR="white" onload="windowTitle();">
|
|
<HR>
|
|
|
|
|
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
|
<A NAME="navbar_top"><!-- --></A>
|
|
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
|
|
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
|
<TR>
|
|
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
|
<A NAME="navbar_top_firstrow"><!-- --></A>
|
|
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
|
<TR ALIGN="center" VALIGN="top">
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/DigitalInput.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
|
</TR>
|
|
</TABLE>
|
|
</TD>
|
|
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
|
</EM>
|
|
</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../../ioio/lib/api/Closeable.html" title="interface in ioio.lib.api"><B>PREV CLASS</B></A>
|
|
<A HREF="../../../ioio/lib/api/DigitalInput.Spec.html" title="class in ioio.lib.api"><B>NEXT CLASS</B></A></FONT></TD>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../../index.html?ioio/lib/api/DigitalInput.html" target="_top"><B>FRAMES</B></A>
|
|
<A HREF="DigitalInput.html" target="_top"><B>NO FRAMES</B></A>
|
|
<SCRIPT type="text/javascript">
|
|
<!--
|
|
if(window==top) {
|
|
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
|
|
}
|
|
//-->
|
|
</SCRIPT>
|
|
<NOSCRIPT>
|
|
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
|
|
</NOSCRIPT>
|
|
|
|
|
|
</FONT></TD>
|
|
</TR>
|
|
<TR>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
|
|
</TR>
|
|
</TABLE>
|
|
<A NAME="skip-navbar_top"></A>
|
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
|
|
|
<HR>
|
|
<!-- ======== START OF CLASS DATA ======== -->
|
|
<H2>
|
|
<FONT SIZE="-1">
|
|
ioio.lib.api</FONT>
|
|
<BR>
|
|
Interface DigitalInput</H2>
|
|
<DL>
|
|
<DT><B>All Superinterfaces:</B> <DD><A HREF="../../../ioio/lib/api/Closeable.html" title="interface in ioio.lib.api">Closeable</A></DD>
|
|
</DL>
|
|
<HR>
|
|
<DL>
|
|
<DT><PRE>public interface <B>DigitalInput</B><DT>extends <A HREF="../../../ioio/lib/api/Closeable.html" title="interface in ioio.lib.api">Closeable</A></DL>
|
|
</PRE>
|
|
|
|
<P>
|
|
A pin used for digital input.
|
|
<p>
|
|
A digital input pin can be used to read logic-level signals. DigitalInput
|
|
instances are obtained by calling <CODE>IOIO#openDigitalInput(Spec)</CODE>.
|
|
<p>
|
|
The value of the pin is obtained by calling <A HREF="../../../ioio/lib/api/DigitalInput.html#read()"><CODE>read()</CODE></A>. It is also
|
|
possible for the client to block until a certain level is sensed, by using
|
|
<A HREF="../../../ioio/lib/api/DigitalInput.html#waitForValue(boolean)"><CODE>waitForValue(boolean)</CODE></A>.
|
|
<p>
|
|
The instance is alive since its creation. The first <A HREF="../../../ioio/lib/api/DigitalInput.html#read()"><CODE>read()</CODE></A> call
|
|
block for a few milliseconds until the initial value is updated. If the
|
|
connection with the IOIO drops at any point, the instance transitions to a
|
|
disconnected state, in which every attempt to use the pin (except
|
|
<A HREF="../../../ioio/lib/api/Closeable.html#close()"><CODE>Closeable.close()</CODE></A>) will throw a <A HREF="../../../ioio/lib/api/exception/ConnectionLostException.html" title="class in ioio.lib.api.exception"><CODE>ConnectionLostException</CODE></A>. Whenever
|
|
<A HREF="../../../ioio/lib/api/Closeable.html#close()"><CODE>Closeable.close()</CODE></A> is invoked the instance may no longer be used. Any resources
|
|
associated with it are freed and can be reused.
|
|
<p>
|
|
Typical usage:
|
|
|
|
<pre>
|
|
DigitalInput button = ioio.openDigitalInput(10); // used an external pull-up
|
|
button.waitForValue(false); // wait for press
|
|
...
|
|
button.close(); // pin 10 can now be used for something else.
|
|
</pre>
|
|
<P>
|
|
|
|
<P>
|
|
<HR>
|
|
|
|
<P>
|
|
<!-- ======== NESTED CLASS SUMMARY ======== -->
|
|
|
|
<A NAME="nested_class_summary"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
<B>Nested Class Summary</B></FONT></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE>static class</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../ioio/lib/api/DigitalInput.Spec.html" title="class in ioio.lib.api">DigitalInput.Spec</A></B></CODE>
|
|
|
|
<BR>
|
|
A digital input pin specification, used when opening digital inputs.</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
|
|
|
<A NAME="method_summary"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
<B>Method Summary</B></FONT></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> boolean</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../ioio/lib/api/DigitalInput.html#read()">read</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Read the value sensed on the pin.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> void</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../ioio/lib/api/DigitalInput.html#waitForValue(boolean)">waitForValue</A></B>(boolean value)</CODE>
|
|
|
|
<BR>
|
|
Block until a desired logical level is sensed.</TD>
|
|
</TR>
|
|
</TABLE>
|
|
<A NAME="methods_inherited_from_class_ioio.lib.api.Closeable"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
|
|
<TH ALIGN="left"><B>Methods inherited from interface ioio.lib.api.<A HREF="../../../ioio/lib/api/Closeable.html" title="interface in ioio.lib.api">Closeable</A></B></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><CODE><A HREF="../../../ioio/lib/api/Closeable.html#close()">close</A></CODE></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<P>
|
|
|
|
<!-- ============ METHOD DETAIL ========== -->
|
|
|
|
<A NAME="method_detail"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
|
|
<B>Method Detail</B></FONT></TH>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<A NAME="read()"><!-- --></A><H3>
|
|
read</H3>
|
|
<PRE>
|
|
boolean <B>read</B>()
|
|
throws java.lang.InterruptedException,
|
|
<A HREF="../../../ioio/lib/api/exception/ConnectionLostException.html" title="class in ioio.lib.api.exception">ConnectionLostException</A></PRE>
|
|
<DL>
|
|
<DD>Read the value sensed on the pin. May block for a few milliseconds if
|
|
called right after creation of the instance. If this is a problem, the
|
|
calling thread may be interrupted.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>True for logical "HIGH", false for logical "LOW".
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE>java.lang.InterruptedException</CODE> - The calling thread has been interrupted.
|
|
<DD><CODE><A HREF="../../../ioio/lib/api/exception/ConnectionLostException.html" title="class in ioio.lib.api.exception">ConnectionLostException</A></CODE> - The connection with the IOIO has been lost.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="waitForValue(boolean)"><!-- --></A><H3>
|
|
waitForValue</H3>
|
|
<PRE>
|
|
void <B>waitForValue</B>(boolean value)
|
|
throws java.lang.InterruptedException,
|
|
<A HREF="../../../ioio/lib/api/exception/ConnectionLostException.html" title="class in ioio.lib.api.exception">ConnectionLostException</A></PRE>
|
|
<DL>
|
|
<DD>Block until a desired logical level is sensed. The calling thread can be
|
|
interrupted for aborting this operation.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>value</CODE> - The desired logical level. true for "HIGH", false for "LOW".
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE>java.lang.InterruptedException</CODE> - The calling thread has been interrupted.
|
|
<DD><CODE><A HREF="../../../ioio/lib/api/exception/ConnectionLostException.html" title="class in ioio.lib.api.exception">ConnectionLostException</A></CODE> - The connection with the IOIO has been lost.</DL>
|
|
</DD>
|
|
</DL>
|
|
<!-- ========= END OF CLASS DATA ========= -->
|
|
<HR>
|
|
|
|
|
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
|
<A NAME="navbar_bottom"><!-- --></A>
|
|
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
|
|
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
|
<TR>
|
|
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
|
<A NAME="navbar_bottom_firstrow"><!-- --></A>
|
|
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
|
<TR ALIGN="center" VALIGN="top">
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/DigitalInput.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
|
</TR>
|
|
</TABLE>
|
|
</TD>
|
|
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
|
</EM>
|
|
</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../../ioio/lib/api/Closeable.html" title="interface in ioio.lib.api"><B>PREV CLASS</B></A>
|
|
<A HREF="../../../ioio/lib/api/DigitalInput.Spec.html" title="class in ioio.lib.api"><B>NEXT CLASS</B></A></FONT></TD>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../../index.html?ioio/lib/api/DigitalInput.html" target="_top"><B>FRAMES</B></A>
|
|
<A HREF="DigitalInput.html" target="_top"><B>NO FRAMES</B></A>
|
|
<SCRIPT type="text/javascript">
|
|
<!--
|
|
if(window==top) {
|
|
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
|
|
}
|
|
//-->
|
|
</SCRIPT>
|
|
<NOSCRIPT>
|
|
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
|
|
</NOSCRIPT>
|
|
|
|
|
|
</FONT></TD>
|
|
</TR>
|
|
<TR>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
|
|
</TR>
|
|
</TABLE>
|
|
<A NAME="skip-navbar_bottom"></A>
|
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
|
|
<HR>
|
|
|
|
</BODY>
|
|
</HTML>
|