public class CANSD540
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
CANSD540.LimitSwitchBehavior
An enumeration representing the default state of a limit switch.
|
static class |
CANSD540.StopMode
An enumeration representing how the SD540C should stop.
|
Constructor and Description |
---|
CANSD540(int deviceNumber)
An instance of this object represents a single SD540C device.
|
public CANSD540(int deviceNumber)
free()
first.deviceNumber
- An integer between 1 and 60 (inclusive) for the ID of
this SD540C. CAN IDs can be modified through the mindsensors configuration
tool, avaliable at
mindsensors.com/pages/311. Devices will ship with a factory default
CAN ID of 3. Please use a unique ID for each device.public static java.lang.String getLibraryVersion()
major.minor
, for example: "1.1"public void free()
public int getDeviceID()
public java.lang.String getDeviceName()
public java.lang.String getFirmwareVersion()
public java.lang.String getHardwareVersion()
public java.lang.String getBootloaderVersion()
public java.lang.String getSerialNumber()
public void blinkLED(int seconds)
seconds
- The number of seconds to blink.public void set(double speed)
speed
- The speed to set this SD540C to. Speed must be in the range
-1.0 to 1.0 (inclusive).public double get()
public void setInverted(boolean isInverted)
isInverted
- Whether or not to invert this motor. This can be useful
if SD540C's are mounted in opposite directions. The SD540C will retain
this value even if it loses power.public boolean getInverted()
public void setStopMode(CANSD540.StopMode stopMode)
stopMode
- What action this SD540C will take when stopping.CANSD540.StopMode
public CANSD540.StopMode getStopMode()
CANSD540.StopMode
public void enableLimitSwitches(boolean limitSwitchesEnabled)
limitSwitchesEnabled
- False will disable any limit switch
functionality. True will enable it, causing a triggered limit switch to
stop the motor and not move further in that direction. This value will be
remembered through power cycles.CANSD540.LimitSwitchBehavior
,
setForwardLimitSwitch(LimitSwitchBehavior)
,
setReverseLimitSwitch(LimitSwitchBehavior)
public boolean getLimitSwitchesEnabled()
public void setForwardLimitSwitch(CANSD540.LimitSwitchBehavior behavior)
behavior
- The default expected state of this limit switch. This
value can also be set in the mindsensors configuration tool.CANSD540.LimitSwitchBehavior
,
enableLimitSwitches(boolean)
public CANSD540.LimitSwitchBehavior getForwardLimitSwitch()
CANSD540.LimitSwitchBehavior
public void setReverseLimitSwitch(CANSD540.LimitSwitchBehavior behavior)
behavior
- The default expected state of this limit switch. This
value can also be set in the mindsensors configuration tool.CANSD540.LimitSwitchBehavior
,
enableLimitSwitches(boolean)
public CANSD540.LimitSwitchBehavior getReverseLimitSwitch()
CANSD540.LimitSwitchBehavior
public void setVoltageRamp(int voltageRamp)
voltageRamp
- A non-negative integer between 0 and 255 (inclusive)
to use for the voltage ramppublic double getBatteryVoltage()
public boolean GetForwardLimitSwitchState()
public boolean GetReverseLimitSwitchState()