<< zurück
Das Paket "rcxdirect"
Mit Hilfe dieses Pakets kann der RCX-Baustein direkt über die Infrarot-Schnittstelle des Towers angesteuert werden.
- Das Beispiel "RCXDirectTest.java"
- Bedienung:
- Downloaden Sie "Direct-RCX" auf Ihren RCX-Baustein
(RCXDirectMode)
- Kopieren Sie RCXDirectTest.java, rcxtools.jar
und RCXTools.properties in ein gemeinsames Verzeichnis.
- Compilieren: javac
-classpath rcxtools.jar RCXDirectTest.java
- Ausführen: java
-classpath .;rcxtools.jar RCXDirectTest
Klassen und Methoden:
rcxdirect
Class Battery
|
|
rcxdirect
Class Motor
|
|
Method Summary |
void |
backward()
Causes motor to rotate backwards. |
void |
flt()
Causes motor to float. |
void |
forward()
Causes motor to rotate forward. |
int |
getPower()
Returns the current motor power. |
void |
setPower(int aPower)
Sets motor power to a value between 0 and 7. |
void |
stop()
Causes motor to stop, pretty much
instantaneously. |
|
rcxdirect
Class Motors
|
Method Summary |
static void |
control |
(int aMode, int bMode, int cMode,
int aPower, int bPower, int cPower) |
|
Sets motor direction for each motor to a value between 1 and 4
(1=forward, 2=backward, 3=stop, 4=float) and motor power to a value between 0 and 7 |
|
|
rcxdirect
Class Port
|
Method Summary |
static String |
getName()
Returns the string representing the serial port
that will be used to transfer data to the RCX. |
static void |
setName(String aPortName)
Sets the serial port that will be used to transfer data to the RCX, i.e. COM1, /dev/ttyS0. |
|
rcxdirect
Class Sensor
|
Field Summary |
static Sensor |
S1
Sensor labeled 1 on RCX. |
static Sensor |
S2
Sensor labeled 2 on RCX. |
static Sensor |
S3
Sensor labeled 3 on RCX. |
|
Method Summary |
boolean |
readBooleanValue()
Reads the boolean value of the sensor. |
int |
readRawValue()
Reads the raw value of the sensor. |
int |
readValue()
Reads the canonical value of the sensor. |
|
rcxdirect
Class Sound
|
Method Summary |
static void |
beep()
Beeps once. |
static void |
beepSequence()
Downward tones. |
static void |
buzz()
Low buzz. |
static void |
systemSound(int aCode)
Play a system sound.
|
static void |
twoBeeps()
Beeps twice. |
|
|