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

PiStorms: This class provides functions for PiStorms. More...

Inheritance diagram for PiStorms.PiStorms:
rmap.rmap_PISTORMS

Public Member Functions

def __init__
 Initialize the PiStorms motor and sensor ports. More...
 
def command
 
def Shutdown
 Shutdown the Raspberry Pi. More...
 
def battVoltage
 Returns the input battery voltage. More...
 
def GetFirmwareVersion
 Returns the PiStorms firmware version. More...
 
def GetVendorName
 Returns the PiStorms vendor name. More...
 
def GetDeviceId
 Returns the PiStorms device ID. More...
 
def led
 Writes to the specified RGB LED. More...
 
def isKeyPressed
 Check if the GO button is pressed. More...
 
def waitForKeyPress
 Wait until the GO button is pressed. More...
 
def untilKeyPress
 Repeat an action until the GO button is pressed. More...
 
def getKeyPressValue
 Check if any Function button is pressed. More...
 
def isF1Pressed
 Check if F1 Function button is pressed. More...
 
def isF2Pressed
 Check if F2 Function button is pressed. More...
 
def isF3Pressed
 Check if F3 Function button is pressed. More...
 
def isF4Pressed
 Check if F4 Function button is pressed. More...
 
def getKeyPressCount
 Returns the GO button press count. More...
 
def resetKeyPressCount
 Resets the GO button press count. More...
 

Public Attributes

 screen
 An instance of mindsensorsUI.mindsensorsUI representing the PiStorms's touchscreen. More...
 
 psc
 An instance of PiStormsCom.PiStormsCom. More...
 
 BAS1
 An instance of PiStormsSensor representing Bank A sensor 1. More...
 
 BAS2
 An instance of PiStormsSensor representing Bank A sensor 2. More...
 
 BBS1
 An instance of PiStormsSensor representing Bank B sensor 1. More...
 
 BBS2
 An instance of PiStormsSensor representing Bank B sensor 2. More...
 
 BAM1
 An instance of PiStormsMotor representing Bank A motor 1. More...
 
 BAM2
 An instance of PiStormsMotor representing Bank A motor 2. More...
 
 BBM1
 An instance of PiStormsMotor representing Bank B motor 1. More...
 
 BBM2
 An instance of PiStormsMotor representing Bank B motor 2. More...
 

Detailed Description

PiStorms: This class provides functions for PiStorms.

PiStormsSensor, PiStormsMotor, and mindsensorsUI are subclasses of PiStorms and are automatically initialized with initialization of PiStorms class.

Constructor & Destructor Documentation

def PiStorms.PiStorms.__init__ (   self,
  name = "PiStorms",
  rotation = 3 
)

Initialize the PiStorms motor and sensor ports.

Parameters
selfThe object pointer.
nameThe display title that will appear at the top of the LCD touchscreen.
rotationThe rotation of the LCD touchscreen.
Remarks
There is no need to use this function directly. To initialize the PiStorms class in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()

Member Function Documentation

def PiStorms.PiStorms.battVoltage (   self)

Returns the input battery voltage.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 volts = psm.battVoltage()
5 if(volts > 6):
6  # do some task
def PiStorms.PiStorms.GetDeviceId (   self)

Returns the PiStorms device ID.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 devID = psm.GetDeviceId()
5 print str(devID)
def PiStorms.PiStorms.GetFirmwareVersion (   self)

Returns the PiStorms firmware version.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 fwVersion = psm.GetFirmwareVersion()
5 print str(fwVersion)
def PiStorms.PiStorms.getKeyPressCount (   self)

Returns the GO button press count.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 keyCount = psm.getKeyPressCount()
5 if(keyCount == 5):
6  # do some task
def PiStorms.PiStorms.getKeyPressValue (   self)

Check if any Function button is pressed.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 key = psm.getKeyValue()
5 if(key == 40):
6  # (40 is F4), do some task
def PiStorms.PiStorms.GetVendorName (   self)

Returns the PiStorms vendor name.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 venName = psm.GetVendorName()
5 print str(venName)
def PiStorms.PiStorms.isF1Pressed (   self)

Check if F1 Function button is pressed.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 key = psm.isF1Pressed()
5 if(key == True):
6  # F1 is pressed, do some task
def PiStorms.PiStorms.isF2Pressed (   self)

Check if F2 Function button is pressed.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 key = psm.isF2Pressed()
5 if(key == True):
6  # F2 is pressed, do some task
def PiStorms.PiStorms.isF3Pressed (   self)

Check if F3 Function button is pressed.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 key = psm.isF3Pressed()
5 if(key == True):
6  # F3 is pressed, do some task
def PiStorms.PiStorms.isF4Pressed (   self)

Check if F4 Function button is pressed.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 key = psm.isF4Pressed()
5 if(key == True):
6  # F4 is pressed, do some task
def PiStorms.PiStorms.isKeyPressed (   self)

Check if the GO button is pressed.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 key = psm.isKeyPressed()
5 if(key == True):
6  # do some task
def PiStorms.PiStorms.led (   self,
  lednum,
  red,
  green,
  blue 
)

Writes to the specified RGB LED.

Parameters
selfThe object pointer.
lednumThe number to specify the LED (1 for BankA, 2 for BankB).
redThe red value to write to the specified LED (0-255).
greenThe green value to write to the specified LED (0-255).
blueThe blue value to write to the specified LED (0-255).
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 psm.led(1,255,0,0)
def PiStorms.PiStorms.resetKeyPressCount (   self)

Resets the GO button press count.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 resetKeyPressCount()
def PiStorms.PiStorms.Shutdown (   self)

Shutdown the Raspberry Pi.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 psm.Shutdown()
def PiStorms.PiStorms.untilKeyPress (   self,
  func,
  args,
  kwargs 
)

Repeat an action until the GO button is pressed.

Parameters
selfThe object pointer.
funcThe function to be called repeatedly
argsPositional arguments to be passed to func
kwargsKeyword arguments to be passed to func
Warning
Beware of scope issues! In Python, functions introduce a new scope. You might have to use the keyword "global" to achieve your intended behavior.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 
5 def mainLoop():
6  psm.screen.termPrintln(psm.battVoltage())
7 
8 psm.untilKeyPress(mainLoop)
def PiStorms.PiStorms.waitForKeyPress (   self)

Wait until the GO button is pressed.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 psm.screen.termPrintln("Press GO to continue...")
5 psm.waitForKeyPress()

Member Data Documentation

PiStorms.PiStorms.BAM1

An instance of PiStormsMotor representing Bank A motor 1.

PiStorms.PiStorms.BAM2

An instance of PiStormsMotor representing Bank A motor 2.

PiStorms.PiStorms.BAS1

An instance of PiStormsSensor representing Bank A sensor 1.

PiStorms.PiStorms.BAS2

An instance of PiStormsSensor representing Bank A sensor 2.

PiStorms.PiStorms.BBM1

An instance of PiStormsMotor representing Bank B motor 1.

PiStorms.PiStorms.BBM2

An instance of PiStormsMotor representing Bank B motor 2.

PiStorms.PiStorms.BBS1

An instance of PiStormsSensor representing Bank B sensor 1.

PiStorms.PiStorms.BBS2

An instance of PiStormsSensor representing Bank B sensor 2.

PiStorms.PiStorms.psc

An instance of PiStormsCom.PiStormsCom.

PiStorms.PiStorms.screen

An instance of mindsensorsUI.mindsensorsUI representing the PiStorms's touchscreen.


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