PiStorms  4.012
PiStorms Library Reference by mindsensors.com
 All Classes Namespaces Files Functions Variables
LegoDevices.EV3TouchSensor Class Reference
Inheritance diagram for LegoDevices.EV3TouchSensor:
LegoDevices.LegoSensor PiStormsCom.PiStormsCom

Public Member Functions

def __init__
 
def isPressed
 check if the sensor is touched, More...
 
def getBumpCount
 With PiStorms it is possible to count how many times the sensor was touched. More...
 
def resetBumpCount
 With PiStorms it is possible to count how many times the sensor was touched. More...
 
- Public Member Functions inherited from LegoDevices.LegoSensor
def __init__
 
def setType
 Set the sensor type This function is called by the constructor of each sensor's class User programs don't need to call this function.
 
def getType
 
def setMode
 
def retrieveUARTData
 Retrieve the UART data buffer. More...
 
def readNXT
 
- Public Member Functions inherited from PiStormsCom.PiStormsCom
def __init__
 
def Shutdown
 
def command
 
def battVoltage
 
def GetFirmwareVersion
 Read the firmware version of the i2c device.
 
def GetVendorName
 Read the vendor name of the i2c device.
 
def GetDeviceId
 Read the i2c device id.
 
def GetDeviceFeatures
 Read the features from device.
 
def led
 
def isKeyPressed
 
def getKeyPressValue
 
def getKeyPressCount
 
def resetKeyPressCount
 
def ping
 

Public Attributes

 sensornum
 
- Public Attributes inherited from LegoDevices.LegoSensor
 bank
 
 sensornum
 
 type
 
 EV3Cache
 
- Public Attributes inherited from PiStormsCom.PiStormsCom
 ts_cal
 

Additional Inherited Members

- Static Public Attributes inherited from PiStormsCom.PiStormsCom
int PS_SENSOR_TYPE_NONE = 0
 
int PS_SENSOR_TYPE_SWITCH = 1
 
int PS_SENSOR_TYPE_ANALOG = 2
 
int PS_SENSOR_TYPE_LIGHT_REFLECTED = 3
 
int PS_SENSOR_TYPE_LIGHT_AMBIENT = 4
 
int PS_SENSOR_TYPE_SOUND_DB = 5
 
int PS_SENSOR_TYPE_SOUND_DBA = 6
 
int PS_SENSOR_TYPE_LOWSPEED_9V = 7
 
int PS_SENSOR_TYPE_LOWSPEED = 8
 
int PS_SENSOR_TYPE_CUSTOM = 9
 
int PS_SENSOR_TYPE_COLORFULL = 13
 
int PS_SENSOR_TYPE_COLORRED = 14
 
int PS_SENSOR_TYPE_COLORGREEN = 15
 
int PS_SENSOR_TYPE_COLORBLUE = 16
 
int PS_SENSOR_TYPE_COLORNONE = 17
 
int PS_SENSOR_TYPE_EV3_SWITCH = 18
 
int PS_SENSOR_TYPE_EV3 = 19
 
int PS_SENSOR_MODE_EV3_COLOR_REFLECTED = 0
 
int PS_SENSOR_MODE_EV3_COLOR_AMBIENT = 1
 
int PS_SENSOR_MODE_EV3_COLOR_COLOR = 2
 
int PS_SENSOR_MODE_EV3_GYRO_ANGLE = 0
 
int PS_SENSOR_MODE_EV3_GYRO_RATE = 1
 
int PS_SENSOR_MODE_EV3_ULTRASONIC_DIST_CM = 0
 
int PS_SENSOR_MODE_EV3_ULTRASONIC_DIST_IN = 1
 
int PS_SENSOR_MODE_EV3_ULTRASONIC_DETECT = 2
 
int PS_SENSOR_MODE_EV3_IR_PROXIMITY = 0
 
int PS_SENSOR_MODE_EV3_IR_CHANNEL = 1
 
int PS_SENSOR_MODE_EV3_IR_REMOTE = 2
 
int PS_SENSOR_MODE_NXT_LIGHT_REFLECTED = 0
 
int PS_SENSOR_MODE_NXT_LIGHT_AMBIENT = 0
 
int PS_SENSOR_MODE_NXT_COLOR_COLOR = 0
 
int PS_EV3CACHE_READY = 0
 
int PS_EV3CACHE_ID = 1
 
int PS_A_ADDRESS = 0x34
 
int PS_B_ADDRESS = 0x36
 
int PS_Command = 0x41
 
int PS_SetPoint_M1 = 0x42
 
int PS_Speed_M1 = 0x46
 
int PS_Time_M1 = 0x47
 
int PS_CMDB_M1 = 0x48
 
int PS_CMDA_M1 = 0x49
 
int PS_SetPoint_M2 = 0x4A
 
int PS_Speed_M2 = 0x4E
 
int PS_Time_M2 = 0x4F
 
int PS_CMDB_M2 = 0x50
 
int PS_CMDA_M2 = 0x51
 
int PS_Position_M1 = 0x52
 
int PS_Position_M2 = 0x56
 
int PS_Status_M1 = 0x5A
 
int PS_Status_M2 = 0x5B
 
int PS_Tasks_M1 = 0x5C
 
int PS_Tasks_M2 = 0x5D
 
int PS_P_Kp = 0x5E
 
int PS_P_Ki = 0x60
 
int PS_P_Kd = 0x62
 
int PS_S_Kp = 0x64
 
int PS_S_Ki = 0x66
 
int PS_S_Kd = 0x68
 
int PS_PassCount = 0x6A
 
int PS_PassTolerance = 0x6B
 
int PS_ChkSum = 0x6C
 
int PS_BattV = 0x6E
 
int PS_S1_Mode = 0x6F
 
int PS_S1EV_Ready = 0x70
 
int PS_S1EV_SensorID = 0x71
 
int PS_S1EV_Mode = 0x81
 
int PS_S1EV_Length = 0x82
 
int PS_S1EV_Data = 0x83
 
int PS_S1AN_Read = 0x70
 
int PS_S1C_Color = 0x70
 
int PS_S1C_R_cal = 0x71
 
int PS_S1C_G_cal = 0x72
 
int PS_S1C_B_cal = 0x73
 
int PS_S1C_N_cal = 0x74
 
int PS_S1C_R_raw = 0x75
 
int PS_S1C_G_raw = 0x76
 
int PS_S1C_B_raw = 0x77
 
int PS_S1C_N_raw = 0x78
 
int PS_TS_CALIBRATION_DATA_READY = 0x70
 
int PS_TS_CALIBRATION_DATA = 0x71
 
int PS_S2_Mode = 0xA3
 
int PS_S2EV_Ready = 0xA4
 
int PS_S2EV_SensorID = 0xA5
 
int PS_S2EV_Mode = 0xB5
 
int PS_S2EV_Length = 0xB6
 
int PS_S2EV_Data = 0xB7
 
int PS_S2AN_Read = 0xA4
 
int PS_S2C_Color = 0xA4
 
int PS_S2C_R_cal = 0xA5
 
int PS_S2C_G_cal = 0xA6
 
int PS_S2C_B_cal = 0xA7
 
int PS_S2C_N_cal = 0xA8
 
int PS_S2C_R_raw = 0xA9
 
int PS_S2C_G_raw = 0xAA
 
int PS_S2C_B_raw = 0xAB
 
int PS_S2C_N_raw = 0xAC
 
int PS_R = 0xD7
 
int PS_G = 0xD8
 
int PS_B = 0xD9
 
int PS_KeyPress = 0xDA
 
int PS_Key1Count = 0xDB
 
int PS_Key2Count = 0xDC
 
int PS_CONTROL_SPEED = 0x01
 
int PS_CONTROL_RAMP = 0x02
 
int PS_CONTROL_RELATIVE = 0x04
 
int PS_CONTROL_TACHO = 0x08
 
int PS_CONTROL_BRK = 0x10
 
int PS_CONTROL_ON = 0x20
 
int PS_CONTROL_TIME = 0x40
 
int PS_CONTROL_GO = 0x80
 
int R = 0x52
 
int S = 0x53
 
int a = 0x61
 
int b = 0x62
 
int c = 0x63
 
int A = 0x41
 
int B = 0x42
 
int C = 0x43
 
int H = 0x48
 
int E = 0x45
 
int t = 0x74
 
int T = 0x54
 
int w = 0x77
 
int l = 0x6C
 
tuple bankA = mindsensors_i2c(PS_A_ADDRESS >> 1)
 
tuple bankB = mindsensors_i2c(PS_B_ADDRESS >> 1)
 
tuple BAM1 = PSMotor(bankA,1)
 
tuple BAM2 = PSMotor(bankA,2)
 
tuple BBM1 = PSMotor(bankB,1)
 
tuple BBM2 = PSMotor(bankB,2)
 
tuple BAS1 = PSSensor(bankA,1)
 
tuple BAS2 = PSSensor(bankA,2)
 
tuple BBS1 = PSSensor(bankB,1)
 
tuple BBS2 = PSSensor(bankB,2)
 

Member Function Documentation

def LegoDevices.EV3TouchSensor.getBumpCount (   self)

With PiStorms it is possible to count how many times the sensor was touched.

This count is maintained since the PiStorms was powered on. You can reset this count with resetBumpCount()

Returns
count of touches since last reset (or power on)
1 # Create an instance
2 touchSensor = LegoDevices.EV3TouchSensor("BAS1")
3 
4 # read the number of touches.
5 n = touchSensor.getBumpCount()
6 
7 if ( n > max_allowed):
8  # do something
def LegoDevices.EV3TouchSensor.isPressed (   self)

check if the sensor is touched,

Returns
True if it is touched.
1 #
2 # create instance of touch sensor on port BAS1
3 touchSensor = LegoDevices.NXTTouchSensor("BAS1")
4 # read from NXT Touch Sensor
5 touch = touchSensor.isPressed()
6 # if touched, do something
7 if (touch == True):
8  # do something
def LegoDevices.EV3TouchSensor.resetBumpCount (   self)

With PiStorms it is possible to count how many times the sensor was touched.

This count is maintained since the PiStorms was powered on. You can reset this count with resetBumpCount()


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