Libraries.Robots.Spike.Hub Documentation

The hub library provides basic functionalities to get information about the hub as well as pause the hub's actions for a specified time in milliseconds. The information available includes the device UUID number, the Hardware ID number, and the temperature of the hub.

Example Code

use Libraries.Robots.Spike.Hub
Hub hb
hb:Sleep(1000)

Inherits from: Libraries.Language.Object

Actions Documentation

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Example

Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

Example

use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)

GetDeviceUUID()

Returns a string of the device id.

Return

text: Device ID

Example

use Libraries.Robots.Spike.Hub
Hub hb
text deviceID = hb:GetDeviceUUID()

GetHardwareID()

Returns a string of the hardware id.

Return

text: Hardware ID

Example

use Libraries.Robots.Spike.Hub
Hub hb
text hardwareID = hb:GetHardwareID()

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

GetTemperature()

Retrieves the temperature of the hub in decidegrees Celsius

Return

integer: Temperature, the temperature in decidegrees Celsius which is 1/10 of a degree Celsius

Example

use Libraries.Robots.Spike.Hub
Hub hb
integer currentTemperature = hb:GetTemperature()

PowerOff()

Turns off the Spike hub.

Return

integer:

Example

use Libraries.Robots.Spike.Hub
Hub hb
hb:PowerOff()

Sleep(integer value)

Pauses the hub from executing instructions for a given time in milliseconds.

Parameters

  • integer value: The time in milliseconds to Sleep

Example

use Libraries.Robots.Spike.Hub
Hub hb
hb:Sleep(1000)