Skip to content

BrickBot/RCXPort

Repository files navigation

<html>

<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>RCXPort - Java Interface to the Lego Mindstorms RCX</title>
</head>

<body bgcolor="#FFFFFF">

<h1>RCXPort - Java Interface to the Lego Mindstorms RCX</h1>

<h2>Background</h2>

<p><a href="https://web.archive.org/web/20180129103223/http://www.slewis.com/rcxport/">
Link to original project website</a></p>

<p><a href="https://stackoverflow.com/q/7562565">How to get javax.comm API?</a></p>

<h2>Introduction</h2>

<p>I recently bought the <a href="http://www.legomindstorms.com/">Lego
Mindstorms Robotics Kit</a>, and decided that it would make a
cool demo if I could interact with it from Java code. So using
the information available on the <a
href="http://www.crynwr.com/lego-robotics/">Lego Mindstorms
Internals</a> sight describing the <a
href="http://graphics.stanford.edu/~kekoa/rcx/opcodes.html">RCX
Op Codes</a> and the RCX communication interface, I put together
this Java interface for interacting with the RCX from a JVM.</p>

<p>Specifically, I wanted to allow my replicated object system (<a
href="http://www.slewis.com/projects/README.html">ROAPI</a>) to
interact with the RCX. Using the <a
href="http://www.slewis.com/projects/README.html">ROAPI</a> for
code distribution and concurrency control, it's easy to do stuff
like have multiple simultaneous remote users of the RCX (e.g.
from within a multi-user application like a chat), allow code
from remote participants to interact with the RCX, and even allow
two remote RCX's to interact with one another in a real-time
shared virtual space.</p>

<p>The RCXPort interface sends requests and commands to the RCX
via its IR interface. The RCX IR interface plugs into the
computer's serial port, and my code uses the <a
href="http://java.sun.com/products/javacomm/index.html">Java Comm
API</a> to send commands out to the serial port to the RCX via
the IR interface. My code should work with any machine that has a
serial port and is running the JVM (it's not platform specific).</p>

<h2>Requirements</h2>

<p>To use this code you must have the <a
href="http://www.legomindstorms.com">Mindstorms</a> kit itself,
and you must have the <a
href="http://java.sun.com/products/javacomm/index.html">Java Comm
API</a> to communicate with the computer's serial port from Java.
I've been doing development on the Java 2 platform, so that's
what I've tested the code with, but I don't believe there is
anything in my code that would prevent it from compiling/running
on 1.1.X. If you try it out on 1.1.X, please <a
href="mailto:slewis@teleport.com">let me know</a>.</p>

<h2>Downloading</h2>

<p>Click <a href="rcxport.jar">here to download the jar file</a>.
It contains the classes, src, and a copy of this file.</p>

<p>The license is open source, and the source is included in the
package. If you find bugs or use this code for something please <a
href="mailto:slewis@teleport.com">let me know</a>...I would be
interested here what you've done with it.</p>

<p>Documentation (javadocs) for the interface is available online
here. To download the docs, click <a href="rcxportdocs.jar">here</a>.</p>

<h2>Installation</h2>

<p>Put the rcxport.jar file in your classpath, and make sure that
the <a href="http://java.sun.com/products/javacomm/index.html">Java
Comm API</a> is also in your classpath.</p>

<h2>Usage</h2>

<p>See the usage for the test program in rcxport.RCXPort by
typing 'java rcxport.RCXPort'. Also see the javadocs for the
rcxport.RCXPort entry class.</p>

<h2>Future</h2>

<p>I intend to add a language parser sometime, so that I can
parse and compile a high-level language for programming the RCX,
and then use the RCXPort code to download the byte codes to the
RCX. The obvious language choice for this is '<a
href="http://www.enteract.com/~dbaum/lego/nqc/index.html">Not
Quite C</a>' (nqc), a nice high-level language for programming
the RCX by <a href="mailto:dbaum@enteract.com">Dave Baum</a>.
Hopefully I'll have a chance to add a nqc parser sometime soon. </p>

<p>For the time being, the easiest way to generate valid byte
codes for the RCX is to use nqc itself with the -L parameter, and
then remove everything except for the hex byte codes themselves,
which are included in the file generated by the -L parameter. See
the <a href="http://www.enteract.com/~dbaum/lego/nqc/index.html">docs
on nqc</a>.</p>

<p><font size="1">Copyright© Scott B. Lewis, 1999</font></p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp;</p>
</body>
</html>