Spike Prime & Robot Inventor python Library Reference
Spike Prime & Robot Inventor python Library
Public Member Functions | Static Public Attributes | List of all members
lib.mindsensors.PFMATE Class Reference
Inheritance diagram for lib.mindsensors.PFMATE:
lib.mindsensors.SPIKEi2c

Public Member Functions

def __init__ (self, port, address=PFMate_ADDRESS)
 Initialize the class with the i2c address of your PFMate. More...
 
def controlBothMotors (self, channel, operationA, speedA, operationB, speedB)
 Set both PF motors on Channel to operation and Speed. More...
 
def controlMotorA (self, channel, operationA, speedA)
 Set PF motor A on Channel to operation and Speed. More...
 
def controlMotorB (self, channel, operationB, speedB)
 Set PF motor B on Channel to operation and Speed. More...
 
def command (self, cmd)
 Writes a value to the command register. More...
 
- Public Member Functions inherited from lib.mindsensors.SPIKEi2c
def __init__ (self, port, i2c_address, bitrate=100)
 
def readByte (self, reg)
 Read the byte from reg of the i2c device. More...
 
def readArray (self, reg, len)
 read len long data array at reg of the i2c device More...
 
def writeByte (self, reg, value)
 write value at reg of the i2c device More...
 
def writeArray (self, reg, arr)
 write data array at reg of the i2c device More...
 
def readString (self, reg, length)
 Read the string of len from reg of the i2c device. More...
 
def readInteger (self, reg)
 Read the int from reg of the i2c device. More...
 
def readIntegerSigned (self, reg)
 Read the signed int from reg of the i2c device. More...
 
def readLong (self, reg)
 Read the long from reg of the i2c device. More...
 
def GetFirmwareVersion (self)
 Read the firmware version of the i2c device.
 
def GetVendorName (self)
 Read the vendor name of the i2c device.
 
def GetDeviceId (self)
 Read the i2c device id.
 

Static Public Attributes

int PFMate_ADDRESS = 0x48
 Default PFMate I2C Address.
 
 PFMate_address
 
 port
 
 PFMATE_FLOAT
 Constants to specify Float Action.
 
 PFMATE_FORWARD
 Constants to specify Forward Motion.
 
 PFMATE_REVERSE
 Constants to specify Reverse Motion.
 
 PFMATE_BRAKE
 Constants to specify Brake Action.
 
 PFMATE_CHANNEL1
 Constants to specify Channel 1.
 
 PFMATE_CHANNEL2
 Constants to specify Channel 2.
 
 PFMATE_CHANNEL3
 Constants to specify Channel 3.
 
 PFMATE_CHANNEL4
 Constants to specify Channel 4.
 
 PFMATE_COMMAND
 Command Register.
 
 PFMATE_CHANNEL
 Channel Registewr.
 
 PFMATE_MOTORS
 Motor Define Register.
 
 PFMATE_OPER_A
 Motor Operation A Register.
 
 PFMATE_SPEED_A
 Motor Speed A Register.
 
 PFMATE_OPER_B
 Motor Operation B Register.
 
 PFMATE_SPEED_B
 Motor Speed B Register.
 
- Static Public Attributes inherited from lib.mindsensors.SPIKEi2c
int int_clk = -1
 

Additional Inherited Members

- Public Attributes inherited from lib.mindsensors.SPIKEi2c
 SCL
 
 SDA
 
 address
 
 int_clk
 

Constructor & Destructor Documentation

◆ __init__()

def lib.mindsensors.PFMATE.__init__ (   self,
  port,
  address = PFMate_ADDRESS 
)

Initialize the class with the i2c address of your PFMate.

Parameters
portSpike Prime port, PFMate is connected to.
addressis address of your PFMate, skip to use default.

Member Function Documentation

◆ command()

def lib.mindsensors.PFMATE.command (   self,
  cmd 
)

Writes a value to the command register.

Parameters
cmd– value to write to the command register.

◆ controlBothMotors()

def lib.mindsensors.PFMATE.controlBothMotors (   self,
  channel,
  operationA,
  speedA,
  operationB,
  speedB 
)

Set both PF motors on Channel to operation and Speed.

Parameters
channelis PFMATE_CHANNELn where n is 1 to 4
operationAis one of the mode, PFMATE_FLOAT, PFMATE_FORWARD, PFMATE_REVERSE, PFMATE_BRAKE
speedAcan be 0 to 7
operationBis one of the mode, PFMATE_FLOAT, PFMATE_FORWARD, PFMATE_REVERSE, PFMATE_BRAKE
speedBcan be 0 to 7

◆ controlMotorA()

def lib.mindsensors.PFMATE.controlMotorA (   self,
  channel,
  operationA,
  speedA 
)

Set PF motor A on Channel to operation and Speed.

Parameters
channelis PFMATE_CHANNELn where n is 1 to 4
operationAis one of the mode, PFMATE_FLOAT, PFMATE_FORWARD, PFMATE_REVERSE, PFMATE_BRAKE
speedAcan be 0 to 7

◆ controlMotorB()

def lib.mindsensors.PFMATE.controlMotorB (   self,
  channel,
  operationB,
  speedB 
)

Set PF motor B on Channel to operation and Speed.

Parameters
channelis PFMATE_CHANNELn where n is 1 to 4
operationBis one of the mode, PFMATE_FLOAT, PFMATE_FORWARD, PFMATE_REVERSE, PFMATE_BRAKE
speedBcan be 0 to 7

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