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

PiStormsSensor: This class provides functions for configuration, reading, and writing of sensors for use with PiStorms. More...

Public Member Functions

def isTouchedEV3
 Returns the EV3 Touch Sensor touch value. More...
 
def numTouchesEV3
 Returns the EV3 Touch Sensor touch count. More...
 
def resetTouchesEV3
 Resets the EV3 Touch Sensor touch count to zero. More...
 
def distanceIREV3
 Returns the EV3 Infrared Sensor distance value. More...
 
def headingIREV3
 Returns the EV3 Infrared Sensor heading value. More...
 
def distanceRemoteIREV3
 Returns the LEGO IR remote distance value. More...
 
def remoteLeft
 Returns the left button status of the LEGO IR remote (1 = Forward, 0 = Not pressed, -1 = Backwards) More...
 
def remoteRight
 Returns the right button status of the LEGO IR remote (1 = Forward, 0 = Not pressed, -1 = Backwards) More...
 
def distanceUSEV3
 Returns the EV3 Ultrasonic Sensor distance value in millimeters. More...
 
def distanceUSEV3in
 Returns the EV3 Ultrasonic Sensor distance value in 'inches times 10' i.e. More...
 
def presenceUSEV3
 Returns the EV3 Ultrasonic Sensor presence boolean value. More...
 
def gyroAngleEV3
 Returns the EV3 Gyro Sensor angle value. More...
 
def gyroRateEV3
 Returns the EV3 Gyro Sensor rate value. More...
 
def reflectedLightSensorEV3
 Returns the EV3 Color Sensor reflected light value. More...
 
def ambientLightSensorEV3
 Returns the EV3 Color Sensor ambient light value. More...
 
def colorSensorEV3
 Returns the EV3 Color Sensor color value. More...
 
def isTouchedNXT
 Returns the NXT Touch Sensor touch value. More...
 
def numTouchesNXT
 Returns the NXT Touch Sensor touch count. More...
 
def resetTouchesNXT
 Resets the NXT Touch Sensor touch count to zero. More...
 
def SumoEyes
 Returns the mindsensors.com's SumoEyes value (0 = None, 1 = Front, 2 = Left, 3 = Right) More...
 
def lightSensorNXT
 Returns the NXT light sensor value. More...
 
def colorSensorNXT
 Returns the NXT color sensor color value. More...
 
def colorSensorNoneNXT
 Returns the NXT color sensor ambient light value. More...
 
def colorSensorRedNXT
 Returns the NXT color sensor reflected red light value. More...
 
def colorSensorGreenNXT
 Returns the NXT color sensor reflected green light value. More...
 
def colorSensorBlueNXT
 Returns the NXT color sensor reflected blue light value. More...
 
def analogSensor
 Returns an analog sensor value 0-1024. More...
 
def activateCustomSensorI2C
 Configures the sensor port for a custom I2C sensor. More...
 

Static Public Attributes

int PS_SENSOR_COLOR_NONE = 0
 Constant to specify no color.
 
int PS_SENSOR_COLOR_BLACK = 1
 Constant to specify black color.
 
int PS_SENSOR_COLOR_BLUE = 2
 Constant to specify blue color.
 
int PS_SENSOR_COLOR_GREEN = 3
 Constant to specify green color.
 
int PS_SENSOR_COLOR_YELLOW = 4
 Constant to specify yellow color.
 
int PS_SENSOR_COLOR_RED = 5
 Constant to specify red color.
 
int PS_SENSOR_COLOR_WHITE = 6
 Constant to specify white color.
 
int PS_SENSOR_COLOR_BROWN = 7
 Constant to specify brown color.
 

Detailed Description

PiStormsSensor: This class provides functions for configuration, reading, and writing of sensors for use with PiStorms.

Remarks
There is no need to initialize this class directly. This is done automatically during the PiStorms init.

Member Function Documentation

def PiStorms.PiStormsSensor.activateCustomSensorI2C (   self)

Configures the sensor port for a custom I2C sensor.

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

Returns the EV3 Color Sensor ambient light value.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 ambLight = psm.BAS1.ambientLightSensorEV3()
5 if(ambLight > 20 ):
6  # do some task
def PiStorms.PiStormsSensor.analogSensor (   self)

Returns an analog sensor value 0-1024.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 analog = psm.BAS1.analogSensor()
5 if(analog < 600):
6  # do some task
def PiStorms.PiStormsSensor.colorSensorBlueNXT (   self)

Returns the NXT color sensor reflected blue light value.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 blueRefLight = psm.BAS1.colorSensorBlueNXT()
5 if(blueRefLight > 20 ):
6  # do some task
def PiStorms.PiStormsSensor.colorSensorEV3 (   self)

Returns the EV3 Color Sensor color value.

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

Returns the NXT color sensor reflected green light value.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 greenRefLight = psm.BAS1.colorSensorGreenNXT()
5 if(greenRefLight > 20 ):
6  # do some task
def PiStorms.PiStormsSensor.colorSensorNoneNXT (   self)

Returns the NXT color sensor ambient light value.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 ambLight = psm.BAS1.colorSensorNoneNXT()
5 if(ambLight > 20 ):
6  # do some task
def PiStorms.PiStormsSensor.colorSensorNXT (   self)

Returns the NXT color sensor color value.

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

Returns the NXT color sensor reflected red light value.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 redRefLight = psm.BAS1.colorSensorRedNXT()
5 if(redRefLight > 20 ):
6  # do some task
def PiStorms.PiStormsSensor.distanceIREV3 (   self)

Returns the EV3 Infrared Sensor distance value.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 dist = psm.BAS1.distanceIREV3()
5 if(dist < 30 ):
6  # do some task
def PiStorms.PiStormsSensor.distanceRemoteIREV3 (   self,
  channel 
)

Returns the LEGO IR remote distance value.

Parameters
selfThe object pointer.
channelThe channel of your remote control or other IR device.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 remDist = psm.BAS1.distanceRemoteIREV3(1)
5 if(remDist < 50 ):
6  # do some task
def PiStorms.PiStormsSensor.distanceUSEV3 (   self)

Returns the EV3 Ultrasonic Sensor distance value in millimeters.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 dist = psm.BAS1.distanceUSEV3()
5 if(dist < 60 ):
6  # do some task
def PiStorms.PiStormsSensor.distanceUSEV3in (   self)

Returns the EV3 Ultrasonic Sensor distance value in 'inches times 10' i.e.

for an obstacle at 3 inches, you will get a reading of 30

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 dist = psm.BAS1.distanceUSEV3in()
5 if(dist < 100 ):
6  # do some task
def PiStorms.PiStormsSensor.gyroAngleEV3 (   self)

Returns the EV3 Gyro Sensor angle value.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 angle = psm.BAS1.gyroAngleEV3()
5 if(angle > 90 ):
6  # do some task
def PiStorms.PiStormsSensor.gyroRateEV3 (   self)

Returns the EV3 Gyro Sensor rate value.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 rate = psm.BAS1.gyroRateEV3()
5 if(rate > 20 ):
6  # do some task
def PiStorms.PiStormsSensor.headingIREV3 (   self,
  channel 
)

Returns the EV3 Infrared Sensor heading value.

Parameters
selfThe object pointer.
channelThe channel of your remote control or other IR device.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 heading = psm.BAS1.headingIREV3(1)
5 if(heading > 10 ):
6  # do some task
def PiStorms.PiStormsSensor.isTouchedEV3 (   self)

Returns the EV3 Touch Sensor touch value.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 touch = psm.BAS1.isTouchedEV3()
5 if(touch == True ):
6  # do some task
def PiStorms.PiStormsSensor.isTouchedNXT (   self)

Returns the NXT Touch Sensor touch value.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 touch = psm.BAS1.isTouchedNXT()
5 if(touch == True):
6  # do some task
def PiStorms.PiStormsSensor.lightSensorNXT (   self,
  active = True 
)

Returns the NXT light sensor value.

Parameters
selfThe object pointer.
activeThe mode of the nxt light sensor. (True = active/reflected | False = nonactive/ambient)
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 light = psm.BAS1.lightSensorNXT(True)
5 if(light < 450 ):
6  # do some task
def PiStorms.PiStormsSensor.numTouchesEV3 (   self)

Returns the EV3 Touch Sensor touch count.

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

Returns the NXT Touch Sensor touch count.

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

Returns the EV3 Ultrasonic Sensor presence boolean value.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 here = psm.BAS1.presenceUSEV3()
5 if(here == True ):
6  # do some task
def PiStorms.PiStormsSensor.reflectedLightSensorEV3 (   self)

Returns the EV3 Color Sensor reflected light value.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 refLight = psm.BAS1.reflectedLightSensorEV3()
5 if(refLight > 20 ):
6  # do some task
def PiStorms.PiStormsSensor.remoteLeft (   self,
  channel 
)

Returns the left button status of the LEGO IR remote (1 = Forward, 0 = Not pressed, -1 = Backwards)

Parameters
selfThe object pointer.
channelThe channel of your remote control or other IR device.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 remLeftButton = psm.BAS1.remoteLeft(1)
5 if(remLeftButton == 1 ):
6  # do some task
def PiStorms.PiStormsSensor.remoteRight (   self,
  channel 
)

Returns the right button status of the LEGO IR remote (1 = Forward, 0 = Not pressed, -1 = Backwards)

Parameters
selfThe object pointer.
channelThe channel of your remote control or other IR device.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 remRightButton = psm.BAS1.remoteRight(1)
5 if(remRightButton == 1 ):
6  # do some task
def PiStorms.PiStormsSensor.resetTouchesEV3 (   self)

Resets the EV3 Touch Sensor touch count to zero.

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

Resets the NXT Touch Sensor touch count to zero.

Parameters
selfThe object pointer.
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 psm.BAS1.resetTouchesNXT()
def PiStorms.PiStormsSensor.SumoEyes (   self,
  long = True 
)

Returns the mindsensors.com's SumoEyes value (0 = None, 1 = Front, 2 = Left, 3 = Right)

Parameters
selfThe object pointer.
longThe mode of the SumoEyes sensor. (True = long range | False = short range)
Remarks
To use this function in your program:
1 from PiStorms import PiStorms
2 ...
3 psm = PiStorms()
4 sumo = psm.BAS1.SumoEyes(True)
5 if(sumo == 2 ):
6  # do some task

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