ForceSensor

The force sensor is an external device that is connected to the hub through a port. The force sensor library can retrieve the amount of force applied to the force sensor, and detect if it has been pressed.

GetPort()

Returns

integer
Returns the port number of the force sensor

Parameters

None

Example

1 2 3 use Libraries.Robots.Spike.ForceSensor ForceSensor fs integer forceSensorPort = fs:GetPort()

SetPort(integer port)

Returns

None

Parameters

  1. 1.integerport

    The port (0 through 5) the force sensor is attached to and what port number the force sensor object will be set to

Example

1 2 3 use Libraries.Robots.Spike.ForceSensor ForceSensor fs fs:SetPort(0)

GetForce()

Returns

integer
Returns the force applied to the force sensor in decinewtons from 0 to 100

Parameters

None

Example

1 2 3 use Libraries.Robots.Spike.ForceSensor ForceSensor fs integer currentForce = fs:GetForce()

GetForceRaw()

Returns

integer
Returns the raw uncallibrated force applied to the force sensor

Parameters

None

Example

1 2 3 use Libraries.Robots.Spike.ForceSensor ForceSensor fs integer currentRawForce = fs:GetRawForce()

IsPressed()

Returns

boolean
Returns true if the sensor is pressed, false if it is not pressed

Parameters

None

Example

1 2 3 use Libraries.Robots.Spike.ForceSensor ForceSensor fs boolean isForceSensorPressed = fs:IsPressed()