Page cover

EasySpark (Class)

This is the most important class in EasySpark. It uses an EasySpark Config object and creates all of the stuff you need for a SparkMax.

It will contain:

Item
Name in Code

ID

id

Name

name

SparkControllerInfo Object

scInfo

Constants

constants

Controller Object

controller

Spark Object

spark

Spark Encoder

encoder

PID Controller/Closed Loop Controller

PIDcontroller

CANcoder Object

CANcoder

DutyCycleEncoder Object

DutyCycleEncoder

Functions

getPos()

Gets the position of the SparkMax in rotations. If there is a CANcoder or DutyCycleEncoder, it will be used for to get the position by default.

getVel()

Gets the current velocity of the SparkMax in rotations per minute (RPM). If there is a CANcoder, it will be used to get the velocity by default.

setDutyCycle(double percent)

Sets the duty cycle of a SparkMax.

setVoltage(double voltage)

Sets the voltage of the SparkMax. It will use the constant maxVoltage to limit positive and negative values.

setPosition(double position)

Sets the desired position of the SparkMax.

Last updated