public class Robot extends Object
Constructor and Description |
---|
Robot()
Create a new Robot object.
|
Robot(String ip)
Create a new Robot object with a specific IP address.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close a Robot's connections.
|
void |
closeMotor(Motor.Port port)
This method allows you to close one Motor connection.
|
void |
closeSensor(Sensor.Port port)
This method allows you to close one Sensor connection.
|
Buttons |
getButtons()
Get a Buttons object
You can use Buttons for creating ButtonListeners and waiting for ButtonPresses
|
ColorSensor |
getColorSensor(Sensor.Port port)
Get a ColorSensor object attached to the specified port.
|
GyroSensor |
getGyroSensor(Sensor.Port port)
Get a GyroSensor object attached to the specified port.
|
LargeMotor |
getLargeMotor(Motor.Port port)
Get a Motor object attached to the specified port.
|
MediumMotor |
getMediumMotor(Motor.Port port)
Get a Motor object attached to the specified port.
|
Speaker |
getSpeaker()
Get a Speaker object
You can use a Speaker for playing tones through the Robot
|
TouchSensor |
getTouchSensor(Sensor.Port port)
Get an TouchSensor object attached to the specified port.
|
UltrasonicSensor |
getUltrasonicSensor(Sensor.Port port)
Get an UltrasonicSensor object attached to the specified port.
|
static void |
sleep(long millis)
Causes the currently executing thread to sleep (temporarily cease
execution) for the specified number of milliseconds, subject to
the precision and accuracy of system timers and schedulers.
|
public Robot()
public Robot(String ip)
ip
- This defines the IP address of the Robot.public LargeMotor getLargeMotor(Motor.Port port)
port
- The port to which the motor is connected. Must be from Motor.Port
.Motor
public MediumMotor getMediumMotor(Motor.Port port)
port
- The port to which the motor is connected. Must be from Motor.Port
.Motor
public Speaker getSpeaker()
Speaker
public Buttons getButtons()
Buttons
public UltrasonicSensor getUltrasonicSensor(Sensor.Port port)
port
- The port to which the sensor is connected. Must be from Sensor.Port
.public TouchSensor getTouchSensor(Sensor.Port port)
port
- The port to which the sensor is connected. Must be from Sensor.Port
.public ColorSensor getColorSensor(Sensor.Port port)
port
- The port to which the sensor is connected. Must be from Sensor.Port
.public GyroSensor getGyroSensor(Sensor.Port port)
port
- The port to which the sensor is connected. Must be from Sensor.Port
.public static void sleep(long millis)
millis
- the length of time to sleep in millisecondsIllegalArgumentException
- if the value of millis
is negativepublic void close()
public void closeMotor(Motor.Port port)
port
- The port to which the motor is connected.public void closeSensor(Sensor.Port port)
port
- The port to which the sensor is connected.