PiStorms  4.012
PiStorms Library Reference by mindsensors.com
 All Classes Namespaces Files Functions Variables
mindsensors.NXTSERVO Class Reference

NXTSERVO: this class provides servo motor control functions. More...

Inheritance diagram for mindsensors.NXTSERVO:

Public Member Functions

def __init__
 Initialize the class with the i2c address of your NXTServo. More...
 
def command
 Writes a specified command on the command register of the NXTServo. More...
 
def battVoltage
 Reads NXTServo battery voltage in millivolts. More...
 
def setSpeed
 Sets the speed of a servo Has no effect on continuous rotation servos. More...
 
def setPosition
 Sets the position of a servo. More...
 
def runServo
 Runs the specified servo to a specific position at a specified speed. More...
 
def storeInitial
 Store the current settings of the specified servo to initial/default settings (remembered when powered on) More...
 
def reset
 Reset all servos to their default settings. More...
 
def stopServo
 Stop a specific servo This will also completely stop a continuous rotation servo, regardless of its neutral point. More...
 
def setNeutral
 Sets the default neutral position of a user defined servo. More...
 
def haltMacro
 Stop the onboard macro on the NXTServo. More...
 
def resumeMacro
 Resume the onboard macro on the NXTServo. More...
 
def gotoEEPROM
 Go to a given EEPROM position This command re-initializes the macro environment. More...
 
def editMacro
 Edit the onboard macro. More...
 
def pauseMacro
 Temporarily pause the running macro. More...
 

Static Public Attributes

int NXTSERVO_ADDRESS = 0xB0
 Default NXTServo I2C Address.
 
int NXTSERVO_VBATT_SCALER = 37
 Constant Voltage Multiplier.
 
int NXTSERVO_COMMAND = 0x41
 Command Register.
 
int NXTSERVO_VBATT = 0x62
 Input Power Voltage Register.
 

Detailed Description

NXTSERVO: this class provides servo motor control functions.

Constructor & Destructor Documentation

def mindsensors.NXTSERVO.__init__ (   self,
  nxtservo_address = NXTSERVO_ADDRESS 
)

Initialize the class with the i2c address of your NXTServo.

Parameters
selfThe object pointer.
nxtservo_addressAddress of your NXTServo.

Member Function Documentation

def mindsensors.NXTSERVO.battVoltage (   self)

Reads NXTServo battery voltage in millivolts.

Parameters
selfThe object pointer.
def mindsensors.NXTSERVO.command (   self,
  cmd 
)

Writes a specified command on the command register of the NXTServo.

Parameters
selfThe object pointer.
cmdThe command you wish the NXTServo to execute.
def mindsensors.NXTSERVO.editMacro (   self)

Edit the onboard macro.

Parameters
selfThe object pointer.
def mindsensors.NXTSERVO.gotoEEPROM (   self,
  position 
)

Go to a given EEPROM position This command re-initializes the macro environment.

Parameters
selfThe object pointer.
positionThe EEPROM position to go to
def mindsensors.NXTSERVO.haltMacro (   self)

Stop the onboard macro on the NXTServo.

Parameters
selfThe object pointer.
def mindsensors.NXTSERVO.pauseMacro (   self)

Temporarily pause the running macro.

Parameters
selfThe object pointer.
def mindsensors.NXTSERVO.reset (   self)

Reset all servos to their default settings.

Parameters
selfThe object pointer.
def mindsensors.NXTSERVO.resumeMacro (   self)

Resume the onboard macro on the NXTServo.

Parameters
selfThe object pointer.
def mindsensors.NXTSERVO.runServo (   self,
  servoNumber,
  position,
  speed = None 
)

Runs the specified servo to a specific position at a specified speed.

Parameters
selfThe object pointer.
servoNumberThe number of the servo to move (1-8).
positionThe position to set the servo (1-255).
speedThe speed to set the servo (1-255) (not used for continuous rotation servos).
def mindsensors.NXTSERVO.setNeutral (   self,
  servoNumber 
)

Sets the default neutral position of a user defined servo.

Parameters
selfThe object pointer.
servoNumberThe number of the servo you wish to set to the default position.
def mindsensors.NXTSERVO.setPosition (   self,
  servoNumber,
  position 
)

Sets the position of a servo.

Parameters
selfThe object pointer.
servoNumberThe number of the servo to set its position (1-8).
positionThe position to set the servo (1-255).
def mindsensors.NXTSERVO.setSpeed (   self,
  servoNumber,
  speed 
)

Sets the speed of a servo Has no effect on continuous rotation servos.

Parameters
selfThe object pointer.
servoNumberThe number of the servo to set its speed (1-8).
speedThe speed to set the servo (1-255).
def mindsensors.NXTSERVO.stopServo (   self,
  servoNumber 
)

Stop a specific servo This will also completely stop a continuous rotation servo, regardless of its neutral point.

Parameters
selfThe object pointer.
servoNumberThe number of the servo to stop (1-8).
def mindsensors.NXTSERVO.storeInitial (   self,
  servoNumber 
)

Store the current settings of the specified servo to initial/default settings (remembered when powered on)

Parameters
selfThe object pointer.
servoNumberThe number of the servo to save its settings (1-8).

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