§ LimitSwitchBehavior
An enumeration representing the default state of a limit switch.
- See also
- EnableLimitSwitches()
-
SetForwardLimitSwitch()
-
SetReverseLimitSwitch()
Enumerator |
---|
NormallyOpen | This limit switch is expected to be normally open and will only activate when it becomes closed.
|
NormallyClosed | This limit switch is expected to be normally closed and will only activate when it becomes open.
|
§ StopMode
An enumeration representing how the SD540C should stop.
Enumerator |
---|
Coast | Allow the motor to freely turn once stopped.
|
Brake | Motor resist motion when it is stopped.
|
§ CANSD540()
CANSD540::CANSD540 |
( |
uint8_t |
deviceNumber | ) |
|
|
explicit |
An instance of this object represents a single SD540C device. Only a single instance can be created for each device ID. Please construct this object only once when initializing your robot and pass the reference around. If you do with to call this constructor with the same ID later, call the destructor first.
- Parameters
-
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. |
§ BlinkLED()
void CANSD540::BlinkLED |
( |
uint8_t |
seconds | ) |
|
Each SD540C has a build-in LED embedded next to the CAN pins. This command will cause it to blink between red and green for a specified duration. This can be useful in debugging. Please do not confuse thiswith both colors flashing quickly, which signifies that the SD540C can not find a connection to the FRC driver station.
- Parameters
-
seconds | The number of seconds to blink. |
§ EnableLimitSwitches()
void CANSD540::EnableLimitSwitches |
( |
bool |
limitSwitchesEnabled | ) |
|
§ Get()
double CANSD540::Get |
( |
| ) |
const |
- Returns
- The current speed this SD540C is set to.
§ GetBatteryVoltage()
double CANSD540::GetBatteryVoltage |
( |
| ) |
const |
- Returns
- The voltage this SD540C device is currently receiving. A value of 0.0 likely indicates this SD540C is not connected properly. Please check the CAN and power connections, or look to the SD540C user guide on mindsensors.com.
§ GetBootloaderVersion()
string CANSD540::GetBootloaderVersion |
( |
| ) |
const |
- Returns
- The bootloader version of this SD540C. The bootloader is used to update firmware on the SD540C.
§ GetDeviceID()
uint8_t CANSD540::GetDeviceID |
( |
| ) |
const |
- Returns
- The device ID provided when constructing this CANSD540 instance.
§ GetDeviceName()
string CANSD540::GetDeviceName |
( |
| ) |
const |
- Returns
- The name associated with this SD540C. The factory default will be "SD540C", but this value can be changed through the mindsensors configuration tool.
§ GetFirmwareVersion()
string CANSD540::GetFirmwareVersion |
( |
| ) |
const |
- Returns
- The firmware version of this SD540C. Firmware can be updated through the mindsensors configuration tool. This may be considered during inspection at competitions. Firmware updates can provide new features. The firmware version of the SD540C device must be compatible with this library.
§ GetForwardLimitSwitch()
§ GetForwardLimitSwitchState()
bool CANSD540::GetForwardLimitSwitchState |
( |
| ) |
const |
- Returns
- True if the forward limit switch is currently activated. Note this does take in to account the limit switch settings on this SD540C.
§ GetHardwareVersion()
string CANSD540::GetHardwareVersion |
( |
| ) |
const |
- Returns
- The hardware version of this SD540C. Any hardware revisions will have a different hardware version number.
§ GetInverted()
bool CANSD540::GetInverted |
( |
| ) |
const |
- Returns
- Whether or not this SD540C is set inverted.
§ GetLibraryVersion()
string CANSD540::GetLibraryVersion |
( |
| ) |
|
|
static |
- Returns
- The version of this library in the format
major.minor
, for example: "1.1"
§ GetLimitSwitchesEnabled()
bool CANSD540::GetLimitSwitchesEnabled |
( |
| ) |
const |
- Returns
- Whether limit switch functionality is currently enabled or not.
§ GetReverseLimitSwitch()
§ GetReverseLimitSwitchState()
bool CANSD540::GetReverseLimitSwitchState |
( |
| ) |
const |
- Returns
- True if the reverse limit switch is currently activated. Note this does take in to account the limit switch settings on this SD540C.
§ GetSerialNumber()
string CANSD540::GetSerialNumber |
( |
| ) |
const |
- Returns
- The serial number of this device. Each serial number is unique and may be requested for customer support.
§ GetStopMode()
- Returns
- What action this SD540C will take when stopping.
- See also
- StopMode
§ Set()
void CANSD540::Set |
( |
double |
speed | ) |
|
- Parameters
-
speed | The speed to set this SD540C to. Speed must be in the range -1.0 to 1.0 (inclusive). |
§ SetForwardLimitSwitch()
§ SetInverted()
void CANSD540::SetInverted |
( |
bool |
isInverted | ) |
|
- Parameters
-
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. |
§ SetReverseLimitSwitch()
§ SetStopMode()
- Parameters
-
stopMode | What action this SD540C will take when stopping. |
- See also
- StopMode
§ SetVoltageRamp()
void CANSD540::SetVoltageRamp |
( |
uint8_t |
voltageRamp | ) |
|
Set at what rate output voltage will increase or decrease. The default value of 0 will disable voltage ramp (instantly setting the speed to the requested value). A positive integer less than 256 (1-255) will make the SD540C gradually increase or decrease to the new set value. Lower numbers close to zero will reach the new value more quickly, while high numbers will take some time resulting in a smoother motion. A higher voltage ramp will limit the maximum acceleration of the motor.
- Parameters
-
voltageRamp | A non-negative integer between 0 and 255 (inclusive) to use for the voltage ramp |
The documentation for this class was generated from the following files: