public class MServo extends I2CSensor
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION, retryCount
currentMode, modes
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, BROWN, GREEN, GREEN_INDEX, MAX_TYPE, MIN_TYPE, MODE_RAW, NXT_ADC_RES, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HIGHSPEED, TYPE_HIGHSPEED_9V, TYPE_HISPEED, TYPE_LIGHT_ACTIVE, TYPE_LIGHT_INACTIVE, TYPE_LOWSPEED, TYPE_LOWSPEED_9V, TYPE_NO_SENSOR, TYPE_REFLECTION, TYPE_SOUND_DB, TYPE_SOUND_DBA, TYPE_SWITCH, TYPE_TEMPERATURE, WHITE, YELLOW
Constructor and Description |
---|
MServo(I2CPort port,
int location)
The initial Constructor.
|
MServo(I2CPort port,
int location,
java.lang.String servoName)
The initial Constructor.
|
MServo(I2CPort port,
int location,
java.lang.String servoName,
int min_angle,
int max_angle)
Constructor with the feature to set min, max and init angle
|
Modifier and Type | Method and Description |
---|---|
int |
getAngle()
Return the angle used in last operation
|
int |
getPulse()
Return the pulse used in last operation
|
void |
setAngle(int angle)
Method to set an Angle in a RC Servo.
|
void |
setPulse(int pulse)
This method set the pulse in a RC Servo.
|
void |
setSpeed(int speed)
Method to set the Speed in a RC Servo.
|
fetchString, getAddress, getData, getData, getPort, getProductID, getRetryCount, getVendorID, getVersion, sendData, sendData, sendData, setAddress, setRetryCount
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes
close, releaseOnClose
public MServo(I2CPort port, int location)
port
- location
- public MServo(I2CPort port, int location, java.lang.String servoName)
port
- location
- servoName
- public MServo(I2CPort port, int location, java.lang.String servoName, int min_angle, int max_angle)
port
- location
- servoName
- min_angle
- max_angle
- public void setPulse(int pulse)
pulse
- the pulse widthpublic int getPulse()
public void setAngle(int angle)
angle
- the anglepublic int getAngle()
public void setSpeed(int speed)
speed
- the speed