Tic Stepper Motor Controller library for Arduino
Public Member Functions | Protected Attributes | List of all members
TicI2C Class Reference

#include <Tic.h>

Inheritance diagram for TicI2C:
Inheritance graph
[legend]
Collaboration diagram for TicI2C:
Collaboration graph
[legend]

Public Member Functions

 TicI2C (uint8_t address=14)
 
uint8_t getAddress ()
 Gets the I2C address specified in the constructor.
 
void setProduct (TicProduct product)
 
void setTargetPosition (int32_t position)
 
void setTargetVelocity (int32_t velocity)
 
void haltAndSetPosition (int32_t position)
 
void haltAndHold ()
 
void goHomeReverse ()
 
void goHomeForward ()
 
void resetCommandTimeout ()
 
void deenergize ()
 
void energize ()
 
void exitSafeStart ()
 
void enterSafeStart ()
 
void reset ()
 
void clearDriverError ()
 
void setMaxSpeed (uint32_t speed)
 
void setStartingSpeed (uint32_t speed)
 
void setMaxAccel (uint32_t accel)
 
void setMaxDecel (uint32_t decel)
 
void setStepMode (TicStepMode mode)
 
void setCurrentLimit (uint16_t limit)
 
void setDecayMode (TicDecayMode mode)
 
void setAgcMode (TicAgcMode mode)
 
void setAgcBottomCurrentLimit (TicAgcBottomCurrentLimit limit)
 
void setAgcCurrentBoostSteps (TicAgcCurrentBoostSteps steps)
 
void setAgcFrequencyLimit (TicAgcFrequencyLimit limit)
 
TicOperationState getOperationState ()
 
bool getEnergized ()
 
bool getPositionUncertain ()
 
bool getForwardLimitActive ()
 Returns true if one of the forward limit switches is active.
 
bool getReverseLimitActive ()
 Returns true if one of the reverse limit switches is active.
 
bool getHomingActive ()
 Returns true if the Tic's homing procedure is running.
 
uint16_t getErrorStatus ()
 
uint32_t getErrorsOccurred ()
 
TicPlanningMode getPlanningMode ()
 
int32_t getTargetPosition ()
 
int32_t getTargetVelocity ()
 
uint32_t getMaxSpeed ()
 
uint32_t getStartingSpeed ()
 
uint32_t getMaxAccel ()
 
uint32_t getMaxDecel ()
 
int32_t getCurrentPosition ()
 
int32_t getCurrentVelocity ()
 
uint32_t getActingTargetPosition ()
 
uint32_t getTimeSinceLastStep ()
 
TicReset getDeviceReset ()
 
uint16_t getVinVoltage ()
 
uint32_t getUpTime ()
 
int32_t getEncoderPosition ()
 
uint16_t getRCPulseWidth ()
 
uint16_t getAnalogReading (TicPin pin)
 
bool getDigitalReading (TicPin pin)
 
TicPinState getPinState (TicPin pin)
 
TicStepMode getStepMode ()
 
uint16_t getCurrentLimit ()
 
TicDecayMode getDecayMode ()
 
TicInputState getInputState ()
 
uint16_t getInputAfterAveraging ()
 
uint16_t getInputAfterHysteresis ()
 
int32_t getInputAfterScaling ()
 
TicMotorDriverError getLastMotorDriverError ()
 
TicAgcMode getAgcMode ()
 
TicAgcBottomCurrentLimit getAgcBottomCurrentLimit ()
 
TicAgcCurrentBoostSteps getAgcCurrentBoostSteps ()
 
TicAgcFrequencyLimit getAgcFrequencyLimit ()
 
uint8_t getLastHpDriverErrors ()
 
void getSetting (uint8_t offset, uint8_t length, uint8_t *buffer)
 
uint8_t getLastError ()
 

Protected Attributes

uint8_t _lastError = 0
 

Detailed Description

Represents an I2C connection to a Tic.

For the high-level commands you can use on this object, see TicBase.

Definition at line 1420 of file Tic.h.

Constructor & Destructor Documentation

◆ TicI2C()

TicI2C::TicI2C ( uint8_t  address = 14)
inline

Creates a new TicI2C object that will use the Wire object to communicate with the Tic over I2C.

The address parameter specifies the 7-bit I2C address to use, and it must match the Tic's "Device number" setting. It defaults to 14.

Definition at line 1428 of file Tic.h.

Member Function Documentation

◆ clearDriverError()

void TicBase::clearDriverError ( )
inlineinherited

Attempts to clear a motor driver error.

Example usage:

tic.clearDriverError();

This function sends a "Clear driver error" command to the Tic. For more information, see the Tic user's guide.

Definition at line 546 of file Tic.h.

◆ deenergize()

void TicBase::deenergize ( )
inlineinherited

De-energizes the stepper motor coils.

Example usage:

tic.deenergize();

This function sends a De-energize command to the Tic, causing it to disable its stepper motor driver. The motor will stop moving and consuming power. The Tic will set the "Intentionally de-energized" error bit, turn on its red LED, and drive its ERR line high. This command also sets the "Position uncertain" flag (because the Tic is no longer in control of the motor's position).

Note that the Energize command, which can be sent with energize(), will undo the effect of this command (except it will leave the "Position uncertain" flag set) and could make the system start up again.

See also haltAndHold().

Definition at line 464 of file Tic.h.

◆ energize()

void TicBase::energize ( )
inlineinherited

Sends the Energize command.

Example usage:

tic.energize();

This function sends an Energize command to the Tic, clearing the "Intentionally de-energized" error bit. If there are no other errors, this allows the system to start up.

Definition at line 479 of file Tic.h.

◆ enterSafeStart()

void TicBase::enterSafeStart ( )
inlineinherited

Sends the "Enter safe start" command.

Example usage:

tic.enterSafeStart();

This command has no effect if safe-start is disabled in the Tic's settings.

In Serial/I2C/USB control mode, this command causes the Tic to stop the motor and set its safe start violation error bit. An "Exit safe start" command is required before the Tic will move the motor again.

See the Tic user's guide for information about what this command does in the other control modes.

Definition at line 514 of file Tic.h.

◆ exitSafeStart()

void TicBase::exitSafeStart ( )
inlineinherited

Sends the "Exit safe start" command.

Example usage:

tic.exitSafeStart();

In Serial/I2C/USB control mode, this command causes the safe start violation error to be cleared for 200 ms. If there are no other errors, this allows the system to start up.

Definition at line 494 of file Tic.h.

◆ getActingTargetPosition()

uint32_t TicBase::getActingTargetPosition ( )
inlineinherited

Gets the acting target position, in microsteps.

This is a variable used in the Tic's target position step planning algorithm, and it could be invalid while the motor is stopped.

This is mainly intended for getting insight into how the Tic's algorithms work or troubleshooting issues, and most people should not use this.

Definition at line 949 of file Tic.h.

◆ getAgcBottomCurrentLimit()

TicAgcBottomCurrentLimit TicBase::getAgcBottomCurrentLimit ( )
inlineinherited

Gets the AGC bottom current limit.

This is only valid for the Tic T249.

See also setAgcBottomCurrentLimit().

Definition at line 1216 of file Tic.h.

◆ getAgcCurrentBoostSteps()

TicAgcCurrentBoostSteps TicBase::getAgcCurrentBoostSteps ( )
inlineinherited

Gets the AGC current boost steps.

This is only valid for the Tic T249.

See also setAgcCurrentBoostSteps().

Definition at line 1226 of file Tic.h.

◆ getAgcFrequencyLimit()

TicAgcFrequencyLimit TicBase::getAgcFrequencyLimit ( )
inlineinherited

Gets the AGC frequency limit.

This is only valid for the Tic T249.

See also setAgcFrequencyLimit().

Definition at line 1236 of file Tic.h.

◆ getAgcMode()

TicAgcMode TicBase::getAgcMode ( )
inlineinherited

Gets the AGC mode.

This is only valid for the Tic T249.

See also setAgcMode().

Definition at line 1206 of file Tic.h.

◆ getAnalogReading()

uint16_t TicBase::getAnalogReading ( TicPin  pin)
inlineinherited

Gets the analog reading from the specified pin.

The reading is left-justified, so 0xFFFF represents a voltage equal to the Tic's 5V pin (approximately 4.8 V).

Returns TicInputNull if the analog reading is disabled or not ready.

Example usage:

uint16_t reading = getAnalogReading(TicPin::SDA);
if (reading != TicInputNull && reading < 32768)
{
// The reading is less than about 2.4 V.
}

Definition at line 1052 of file Tic.h.

◆ getCurrentLimit()

uint16_t TicBase::getCurrentLimit ( )
inherited

Gets the stepper motor coil current limit in milliamps.

This is the value being used now, which could differ from the value in the Tic's settings.

Example usage:

uint16_t current = tic.getCurrentLimit();

By default, this function assumes you are using a Tic T825 or Tic T834. If you are using a different kind of Tic, we recommend calling setProduct() some time before calling getCurrentLimit().

See also setCurrentLimit().

Definition at line 84 of file Tic.cpp.

◆ getCurrentPosition()

int32_t TicBase::getCurrentPosition ( )
inlineinherited

Gets the current position of the stepper motor, in microsteps.

Note that this just tracks steps that the Tic has commanded the stepper driver to take; it could be different from the actual position of the motor for various reasons.

For an example of how to use this this, see the SerialPositionControl example or the I2CPositionControl exmaple.

See also haltAndSetPosition().

Definition at line 921 of file Tic.h.

◆ getCurrentVelocity()

int32_t TicBase::getCurrentVelocity ( )
inlineinherited

Gets the current velocity of the stepper motor, in microsteps per 10000 seconds.

Note that this is just the velocity used in the Tic's step planning algorithms, and it might not correspond to the actual velocity of the motor for various reasons.

Example usage:

int32_t velocity = tic.getCurrentVelocity();

Definition at line 937 of file Tic.h.

◆ getDecayMode()

TicDecayMode TicBase::getDecayMode ( )
inlineinherited

Gets the current decay mode of the stepper motor driver.

Example usage:

if (tic.getDecayMode() == TicDecayMode::Slow)
{
// The Tic is in slow decay mode.
}

See setDecayMode().

Definition at line 1136 of file Tic.h.

◆ getDeviceReset()

TicReset TicBase::getDeviceReset ( )
inlineinherited

Gets the cause of the controller's last full microcontroller reset.

Example usage:

if (tic.getDeviceReset() == TicReset::Brownout)
{
// There was a brownout reset; the power supply could not keep up.
}

The Reset command (reset()) does not affect this variable.

Definition at line 978 of file Tic.h.

◆ getDigitalReading()

bool TicBase::getDigitalReading ( TicPin  pin)
inlineinherited

Gets a digital reading from the specified pin.

Returns true for high and false for low.

Example usage:

if (tic.getDigitalReading(TicPin::RC))
{
// Something is driving the RC pin high.
}

Definition at line 1069 of file Tic.h.

◆ getEncoderPosition()

int32_t TicBase::getEncoderPosition ( )
inlineinherited

Gets the raw encoder count measured from the Tic's RX and TX lines.

Example usage:

int32_t encoderPosition = getEncoderPosition();

Definition at line 1014 of file Tic.h.

◆ getEnergized()

bool TicBase::getEnergized ( )
inlineinherited

Returns true if the motor driver is energized (trying to send current to its outputs).

Definition at line 731 of file Tic.h.

◆ getErrorsOccurred()

uint32_t TicBase::getErrorsOccurred ( )
inlineinherited

Gets the errors that have occurred since the last time this function was called.

Note that the Tic Control Center constantly clears the bits in this register, so if you are running the Tic Control Center then you will not be able to reliably detect errors with this function.

Each bit in the returned register represents a different error. The bits are defined in TicError enum.

Example usage:

uint32_t errors = tic.getErrorsOccurred();
if (errors & (1 << (uint8_t)TicError::MotorDriverError))
{
// handle a motor driver error
}

Definition at line 804 of file Tic.h.

◆ getErrorStatus()

uint16_t TicBase::getErrorStatus ( )
inlineinherited

Gets the errors that are currently stopping the motor.

Each bit in the returned register represents a different error. The bits are defined in TicError enum.

Example usage:

uint16_t errors = tic.getErrorStatus();
if (errors & (1 << (uint8_t)TicError::LowVin))
{
// handle loss of power
}

Definition at line 782 of file Tic.h.

◆ getInputAfterAveraging()

uint16_t TicBase::getInputAfterAveraging ( )
inlineinherited

Gets a variable used in the process that converts raw RC and analog values into a motor position or speed. This is mainly for debugging your input scaling settings in an RC or analog mode.

A value of TicInputNull means the input value is not available.

Definition at line 1162 of file Tic.h.

◆ getInputAfterHysteresis()

uint16_t TicBase::getInputAfterHysteresis ( )
inlineinherited

Gets a variable used in the process that converts raw RC and analog values into a motor position or speed. This is mainly for debugging your input scaling settings in an RC or analog mode.

A value of TicInputNull means the input value is not available.

Definition at line 1172 of file Tic.h.

◆ getInputAfterScaling()

int32_t TicBase::getInputAfterScaling ( )
inlineinherited

Gets the value of the Tic's main input after scaling has been applied.

If the input is valid, this number is the target position or target velocity specified by the input.

Example usage:

if (tic.getInputAfter

See also getInputState().

Definition at line 1188 of file Tic.h.

◆ getInputState()

TicInputState TicBase::getInputState ( )
inlineinherited

Gets the current state of the Tic's main input.

Example usage:

if (tic.getInputState() == TicInputState::Position)
{
// The Tic's input is specifying a target position.
}

See TicInputState for more information.

Definition at line 1152 of file Tic.h.

◆ getLastError()

uint8_t TicBase::getLastError ( )
inlineinherited

Returns 0 if the last communication with the device was successful, and non-zero if there was an error.

Definition at line 1273 of file Tic.h.

◆ getLastHpDriverErrors()

uint8_t TicBase::getLastHpDriverErrors ( )
inlineinherited

Gets the "Last HP driver errors" variable.

Each bit in this register represents an error. If the bit is 1, the error was one of the causes of the Tic's last motor driver error.

This is only valid for the Tic 36v4.

Definition at line 1247 of file Tic.h.

◆ getLastMotorDriverError()

TicMotorDriverError TicBase::getLastMotorDriverError ( )
inlineinherited

Gets the cause of the last motor driver error.

This is only valid for the Tic T249.

Definition at line 1196 of file Tic.h.

◆ getMaxAccel()

uint32_t TicBase::getMaxAccel ( )
inlineinherited

Gets the maximum acceleration, in microsteps per second per 100 seconds.

This is the current value, which could differ from the value in the Tic's settings.

Example usage:

uint32_t accelMax = tic.getMaxAccel();

See also setMaxAccel().

Definition at line 890 of file Tic.h.

◆ getMaxDecel()

uint32_t TicBase::getMaxDecel ( )
inlineinherited

Gets the maximum deceleration, in microsteps per second per 100 seconds.

This is the current value, which could differ from the value in the Tic's settings.

Example usage:

uint32_t decelMax = tic.getMaxDecel();

See also setMaxDecel().

Definition at line 906 of file Tic.h.

◆ getMaxSpeed()

uint32_t TicBase::getMaxSpeed ( )
inlineinherited

Gets the current maximum speed, in microsteps per 10000 seconds.

This is the current value, which could differ from the value in the Tic's settings.

See also setMaxSpeed().

Definition at line 858 of file Tic.h.

◆ getOperationState()

TicOperationState TicBase::getOperationState ( )
inlineinherited

Gets the Tic's current operation state, which indicates whether it is operating normally or in an error state.

Example usage:

if (tic.getOperationState() != TicOperationState::Normal)
{
// There is an error, or the Tic is starting up.
}

For more information, see the "Error handling" section of the Tic user's guide.

Definition at line 724 of file Tic.h.

◆ getPinState()

TicPinState TicBase::getPinState ( TicPin  pin)
inlineinherited

Gets the current state of a pin, i.e. what kind of input or output it is.

Note that the state might be misleading if the pin is being used as a serial or I2C pin.

Example usage:

if (tic.getPinState(TicPin::SCL) == TicPinState::OutputHigh)
{
// SCL is driving high.
}

Definition at line 1088 of file Tic.h.

◆ getPlanningMode()

TicPlanningMode TicBase::getPlanningMode ( )
inlineinherited

Returns the current planning mode for the Tic's step generation code.

This tells us whether the Tic is sending steps, and if it is sending steps, tells us whether it is in Target Position or Target Velocity mode.

Example usage:

if (tic.getPlanningMode() == TicPlanningMode::TargetPosition)
{
// The Tic is moving the stepper motor to a target position, or has
// already reached it and is at rest.
}

Definition at line 825 of file Tic.h.

◆ getPositionUncertain()

bool TicBase::getPositionUncertain ( )
inlineinherited

Gets a flag that indicates whether there has been external confirmation that the value of the Tic's "Current position" variable is correct.

For more information, see the "Error handling" section of the Tic user's guide.

Definition at line 742 of file Tic.h.

◆ getRCPulseWidth()

uint16_t TicBase::getRCPulseWidth ( )
inlineinherited

Gets the raw pulse width measured on the Tic's RC input, in units of twelfths of a microsecond.

Returns TicInputNull if the RC input is missing or invalid.

Example usage:

uint16_t pulseWidth = tic.getRCPulseWidth();
if (pulseWidth != TicInputNull && pulseWidth > 18000)
{
// Pulse width is greater than 1500 microseconds.
}

Definition at line 1032 of file Tic.h.

◆ getSetting()

void TicBase::getSetting ( uint8_t  offset,
uint8_t  length,
uint8_t *  buffer 
)
inlineinherited

Gets a contiguous block of settings from the Tic's EEPROM.

The maximum length that can be fetched is 15 bytes.

Example usage:

// Get the Tic's serial device number.
uint8_t deviceNumber;
tic.getSetting(7, 1, &deviceNumber);

This library does not attempt to interpret the settings and say what they mean. If you are interested in how the settings are encoded in the Tic's EEPROM, see the "Settings reference" section of the Tic user's guide.

Definition at line 1266 of file Tic.h.

◆ getStartingSpeed()

uint32_t TicBase::getStartingSpeed ( )
inlineinherited

Gets the starting speed in microsteps per 10000 seconds.

This is the current value, which could differ from the value in the Tic's settings.

Example usage:

uint32_t startingSpeed = tic.getStartingSpeed();

See also setStartingSpeed().

Definition at line 874 of file Tic.h.

◆ getStepMode()

TicStepMode TicBase::getStepMode ( )
inlineinherited

Gets the current step mode of the stepper motor.

Example usage:

if (tic.getStepMode() == TicStepMode::Microstep8)
{
// The Tic is currently using 1/8 microsteps.
}

Definition at line 1103 of file Tic.h.

◆ getTargetPosition()

int32_t TicBase::getTargetPosition ( )
inlineinherited

Gets the target position, in microsteps.

This is only relevant if the planning mode from getPlanningMode() is TicPlanningMode::Position.

See also setTargetPosition().

Definition at line 836 of file Tic.h.

◆ getTargetVelocity()

int32_t TicBase::getTargetVelocity ( )
inlineinherited

Gets the target velocity, in microsteps per 10000 seconds.

This is only relevant if the planning mode from getPlanningMode() is TicPlanningMode::Velocity.

See also setTargetVelocity().

Definition at line 847 of file Tic.h.

◆ getTimeSinceLastStep()

uint32_t TicBase::getTimeSinceLastStep ( )
inlineinherited

Gets the time since the last step, in timer ticks.

Each timer tick represents one third of a microsecond. The Tic only updates this variable every 5 milliseconds or so, and it could be invalid while the motor is stopped.

This is mainly intended for getting insight into how the Tic's algorithms work or troubleshooting issues, and most people should not use this.

Definition at line 962 of file Tic.h.

◆ getUpTime()

uint32_t TicBase::getUpTime ( )
inlineinherited

Gets the time since the last full reset of the Tic's microcontroller, in milliseconds.

Example usage:

uint32_t upTime = tic.getUpTime();

A Reset command (reset())does not count.

Definition at line 1003 of file Tic.h.

◆ getVinVoltage()

uint16_t TicBase::getVinVoltage ( )
inlineinherited

Gets the current measurement of the VIN voltage, in millivolts.

Example usage:

uint16_t power = tic.getVinVoltage();

Definition at line 989 of file Tic.h.

◆ goHomeForward()

void TicBase::goHomeForward ( )
inlineinherited

Tells the Tic to start its homing procedure in the forward direction.

See the "Homing" section of the Tic user's guide for details.

See also goHomeReverse().

Definition at line 427 of file Tic.h.

◆ goHomeReverse()

void TicBase::goHomeReverse ( )
inlineinherited

Tells the Tic to start its homing procedure in the reverse direction.

See the "Homing" section of the Tic user's guide for details.

See also goHomeForward().

Definition at line 417 of file Tic.h.

◆ haltAndHold()

void TicBase::haltAndHold ( )
inlineinherited

Stops the motor abruptly without respecting the deceleration limit.

Example usage:

tic.haltAndHold();

This function sends a "Halt and hold" command to the Tic. Besides stopping the motor, this command also sets the "Position uncertain" flag (because the abrupt stop might cause steps to be missed), sets the "Input state" to "halt", and clears the "Input after scaling" variable.

If the control mode is something other than Serial/I2C/USB, ths command will be silently ignored.

See also deenergize().

Definition at line 407 of file Tic.h.

◆ haltAndSetPosition()

void TicBase::haltAndSetPosition ( int32_t  position)
inlineinherited

Stops the motor abruptly without respecting the deceleration limit and sets the "Current position" variable, which represents where the Tic currently thinks the motor's output is.

Example usage:

tic.haltAndSetPosition(0);

This function sends a "Halt and set position" command to the Tic. Besides stopping the motor and setting the current position, this command also clears the "Postion uncertain" flag, sets the "Input state" to "halt", and clears the "Input after scaling" variable.

If the control mode is something other than Serial, this command will be silently ignored.

Definition at line 386 of file Tic.h.

◆ reset()

void TicBase::reset ( )
inlineinherited

Sends the Reset command.

Example usage:

tic.reset();

This command makes the Tic forget most parts of its current state. For more information, see the Tic user's guide.

Definition at line 528 of file Tic.h.

◆ resetCommandTimeout()

void TicBase::resetCommandTimeout ( )
inlineinherited

Prevents the "Command timeout" error from happening for some time.

Example usage:

tic.resetCommandTimeout();

This function sends a "Reset command timeout" command to the Tic.

Definition at line 440 of file Tic.h.

◆ setAgcBottomCurrentLimit()

void TicBase::setAgcBottomCurrentLimit ( TicAgcBottomCurrentLimit  limit)
inlineinherited

Temporarily sets the AGC bottom current limit.

This is only valid for the Tic T249.

See also getAgcBottomCurrentLimit().

Definition at line 686 of file Tic.h.

◆ setAgcCurrentBoostSteps()

void TicBase::setAgcCurrentBoostSteps ( TicAgcCurrentBoostSteps  steps)
inlineinherited

Temporarily sets the AGC current boost steps.

This is only valid for the Tic T249.

See also getAgcCurrentBoostSteps().

Definition at line 696 of file Tic.h.

◆ setAgcFrequencyLimit()

void TicBase::setAgcFrequencyLimit ( TicAgcFrequencyLimit  limit)
inlineinherited

Temporarily sets the AGC frequency limit.

This is only valid for the Tic T249.

See also getAgcFrequencyLimit().

Definition at line 706 of file Tic.h.

◆ setAgcMode()

void TicBase::setAgcMode ( TicAgcMode  mode)
inlineinherited

Temporarily sets the AGC mode.

This is only valid for the Tic T249.

See also getAgcMode().

Definition at line 676 of file Tic.h.

◆ setCurrentLimit()

void TicBase::setCurrentLimit ( uint16_t  limit)
inherited

Temporarily sets the stepper motor coil current limit in milliamps. If the desired current limit is not available, this function uses the closest current limit that is lower than the desired one.

When converting the current limit from milliamps to a code to send to the Tic, this function needs to know what kind of Tic you are using. By default, this function assumes you are using a Tic T825 or Tic T834. If you are using a different kind of Tic, we recommend calling setProduct() some time before calling setCurrentLimit().

Example usage:

tic.setCurrentLimit(500); // 500 mA

This function sends a "Set current limit" command to the Tic. For more information about this command and how to choose a good current limit, see the Tic user's guide.

See also getCurrentLimit().

Definition at line 41 of file Tic.cpp.

◆ setDecayMode()

void TicBase::setDecayMode ( TicDecayMode  mode)
inlineinherited

Temporarily sets the stepper motor driver's decay mode.

Example usage:

tic.setDecayMode(TicDecayMode::Slow);

The decay modes are documented in the Tic user's guide.

See also getDecayMode().

Definition at line 666 of file Tic.h.

◆ setMaxAccel()

void TicBase::setMaxAccel ( uint32_t  accel)
inlineinherited

Temporarily sets the maximum acceleration, in units of steps per second per 100 seconds.

Example usage:

tic.setMaxAccel(10000); // 100 steps per second per second

This function sends a "Set max acceleration" command to the Tic. For more information, see the Tic user's guide.

See also getMaxAccel().

Definition at line 595 of file Tic.h.

◆ setMaxDecel()

void TicBase::setMaxDecel ( uint32_t  decel)
inlineinherited

Temporarily sets the maximum deceleration, in units of steps per second per 100 seconds.

Example usage:

tic.setMaxDecel(10000); // 100 steps per second per second

This function sends a "Set max deceleration" command to the Tic. For more information, see the Tic user's guide.

See also getMaxDecel().

Definition at line 612 of file Tic.h.

◆ setMaxSpeed()

void TicBase::setMaxSpeed ( uint32_t  speed)
inlineinherited

Temporarily sets the maximum speed, in units of steps per 10000 seconds.

Example usage:

tic.setMaxSpeed(5550000); // 555 steps per second

This function sends a "Set max speed" command to the Tic. For more information, see the Tic user's guide.

See also getMaxSpeed().

Definition at line 562 of file Tic.h.

◆ setProduct()

void TicBase::setProduct ( TicProduct  product)
inlineinherited

You can use this function to specify what type of Tic you are using.

Example usage (pick one of the following):

tic.setProduct(TicProduct::T500);
tic.setProduct(TicProduct::T834);
tic.setProduct(TicProduct::T825);
tic.setProduct(TicProduct::T249);
tic.setProduct(TicProduct::Tic36v4);

This changes the behavior of the setCurrentLimit() function.

Definition at line 327 of file Tic.h.

◆ setStartingSpeed()

void TicBase::setStartingSpeed ( uint32_t  speed)
inlineinherited

Temporarily sets the starting speed, in units of steps per 10000 seconds.

Example usage:

tic.setStartingSpeed(500000); // 50 steps per second

This function sends a "Set starting speed" command to the Tic. For more information, see the Tic user's guide.

See also getStartingSpeed().

Definition at line 578 of file Tic.h.

◆ setStepMode()

void TicBase::setStepMode ( TicStepMode  mode)
inlineinherited

Temporarily sets the stepper motor's step mode, which defines how many microsteps correspond to one full step.

Example usage:

tic.setStepMode(TicStepMode::Microstep8);

This function sends a "Set step mode" command to the Tic. For more information, see the Tic user's guide.

See also getStepMode().

Definition at line 629 of file Tic.h.

◆ setTargetPosition()

void TicBase::setTargetPosition ( int32_t  position)
inlineinherited

Sets the target position of the Tic, in microsteps.

Example usage:

tic.setTargetPosition(100);

This function sends a "Set target position" to the Tic. If the Control mode is set to Serial/I2C/USB, the Tic will start moving the motor to reach the target position. If the control mode is something other than Serial, this command will be silently ignored.

See also getTargetPosition().

Definition at line 345 of file Tic.h.

◆ setTargetVelocity()

void TicBase::setTargetVelocity ( int32_t  velocity)
inlineinherited

Sets the target velocity of the Tic, in microsteps per 10000 seconds.

Example usage:

tic.setTargetVelocity(-1800000); // -180 steps per second

This function sends a "Set target velocity" command to the Tic. If the Control mode is set to Serial/I2C/USB, the Tic will start accelerating or decelerating to reach the target velocity.

If the control mode is something other than Serial, this command will be silently ignored.

See also getTargetVelocity().

Definition at line 365 of file Tic.h.

Member Data Documentation

◆ _lastError

uint8_t TicBase::_lastError = 0
protectedinherited

Zero if the last communication with the device was successful, non-zero otherwise.

Definition at line 1281 of file Tic.h.


The documentation for this class was generated from the following files: