| Home | Trees | Indices | Help |
|---|
|
|
object --+
|
BrickPi3
| Instance Methods | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
| Class Variables | |
PORT_1 = 0x01
|
|
PORT_2 = 0x02
|
|
PORT_3 = 0x04
|
|
PORT_4 = 0x08
|
|
PORT_A = 0x01
|
|
PORT_B = 0x02
|
|
PORT_C = 0x04
|
|
PORT_D = 0x08
|
|
MOTOR_FLOAT = -128
|
|
SensorType = [0, 0, 0, 0]
|
|
I2CInBytes = [0, 0, 0, 0]
|
|
BPSPI_MESSAGE_TYPE = Enumeration(
|
|
SENSOR_TYPE = Enumeration(
|
|
SENSOR_STATE = Enumeration(
|
|
SENSOR_CUSTOM = Enumeration(Flags for use with SENSOR_TYPE.CUSTOM |
|
SENSOR_I2C_SETTINGS = Enumeration(
|
|
MOTOR_STATUS_FLAG = Enumeration(
|
|
| Properties | |
|
Inherited from |
| Method Details |
Do any necessary configuration, and optionally detect the BrickPi3 Optionally specify the SPI address as something other than 1 Optionally disable the detection of the BrickPi3 hardware. This can be used for debugging and testing when the BrickPi3 would otherwise not pass the detection tests.
|
Conduct a SPI transaction Keyword arguments: data_out -- a list of bytes to send. The length of the list will determine how many bytes are transferred. Returns a list of the bytes read. |
Send an 8-bit value over SPI Keyword arguments: MessageType -- the SPI message type Value -- the value to be sent |
Read a 16-bit value over SPI Keyword arguments: MessageType -- the SPI message type Returns: value |
Send a 16-bit value over SPI Keyword arguments: MessageType -- the SPI message type Value -- the value to be sent |
Send a 24-bit value over SPI Keyword arguments: MessageType -- the SPI message type Value -- the value to be sent |
Read a 32-bit value over SPI Keyword arguments: MessageType -- the SPI message type Returns : value |
Send a 32-bit value over SPI Keyword arguments: MessageType -- the SPI message type Value -- the value to be sent |
Read the 20 charactor BrickPi3 manufacturer name Returns: BrickPi3 manufacturer name string |
Read the 20 charactor BrickPi3 board name Returns: BrickPi3 board name string |
Read the hardware version Returns: hardware version |
Read the firmware version Returns: firmware version |
Read the 128-bit BrickPi hardware serial number Returns: serial number as 32 char HEX formatted string |
Control the onboard LED Keyword arguments: value -- the value (in percent) to set the LED brightness to. -1 returns control of the LED to the firmware. |
Get the 3.3v circuit voltage Returns: 3.3v circuit voltage |
Get the 5v circuit voltage Returns: 5v circuit voltage |
Get the 9v circuit voltage Returns: 9v circuit voltage |
Get the battery voltage Returns: battery voltage |
Set the sensor type
Keyword arguments:
port -- The sensor port(s). PORT_1, PORT_2, PORT_3, and/or PORT_4.
type -- The sensor type
params = 0 -- the parameters needed for some sensor types.
params is used for the following sensor types:
CUSTOM -- a 16-bit integer used to configure the hardware.
I2C -- a list of settings:
params[0] -- Settings/flags
params[1] -- target Speed in microseconds (0-255). Realistically the speed will vary.
if SENSOR_I2C_SETTINGS_SAME flag set in I2C Settings:
params[2] -- Delay in microseconds between transactions.
params[3] -- Address
params[4] -- List of bytes to write
params[5] -- Number of bytes to read
|
Conduct an I2C transaction Keyword arguments: port -- The sensor port (one at a time). PORT_1, PORT_2, PORT_3, or PORT_4. Address -- The I2C address for the device. Bits 1-7, not 0-6. OutArray -- A list of bytes to write to the device InBytes -- The number of bytes to read from the device |
Read a sensor value
Keyword arguments:
port -- The sensor port (one at a time). PORT_1, PORT_2, PORT_3, or PORT_4.
Returns the value(s) for the specified sensor.
The following sensor types each return a single value:
NONE ----------------------- 0
TOUCH ---------------------- 0 or 1 (released or pressed)
NXT_TOUCH ------------------ 0 or 1 (released or pressed)
EV3_TOUCH ------------------ 0 or 1 (released or pressed)
NXT_ULTRASONIC ------------- distance in CM
NXT_LIGHT_ON -------------- reflected light
NXT_LIGHT_OFF -------------- ambient light
NXT_COLOR_RED -------------- red reflected light
NXT_COLOR_GREEN ------------ green reflected light
NXT_COLOR_BLUE ------------- blue reflected light
NXT_COLOR_OFF -------------- ambient light
EV3_GYRO_ABS --------------- absolute rotation position in degrees
EV3_GYRO_DPS --------------- rotation rate in degrees per second
EV3_COLOR_REFLECTED -------- red reflected light
EV3_COLOR_AMBIENT ---------- ambient light
EV3_COLOR_COLOR ------------ detected color
EV3_ULTRASONIC_CM ---------- distance in CM
EV3_ULTRASONIC_INCHES ------ distance in inches
EV3_ULTRASONIC_LISTEN ------ 0 or 1 (no other ultrasonic sensors or another ultrasonic sensor detected)
EV3_INFRARED_PROXIMITY ----- distance 0-100%
The following sensor types each return a list of values
CUSTOM --------------------- Pin 1 ADC (5v scale from 0 to 4095), Pin 6 ADC (3.3v scale from 0 to 4095), Pin 5 digital, Pin 6 digital
I2C ------------------------ the I2C bytes read
NXT_COLOR_FULL ------------- detected color, red light reflected, green light reflected, blue light reflected, ambient light
EV3_GYRO_ABS_DPS ----------- absolute rotation position in degrees, rotation rate in degrees per second
EV3_COLOR_RAW_REFLECTED ---- red reflected light, unknown value (maybe a raw ambient value?)
EV3_COLOR_COLOR_COMPONENTS - red reflected light, green reflected light, blue reflected light, unknown value (maybe a raw value?)
EV3_INFRARED_SEEK ---------- a list for each of the four channels. For each channel heading (-25 to 25), distance (-128 or 0 to 100)
EV3_INFRARED_REMOTE -------- a list for each of the four channels. For each channel red up, red down, blue up, blue down, boadcast
|
Set the motor power in percent Keyword arguments: port -- The Motor port(s). PORT_A, PORT_B, PORT_C, and/or PORT_D. power -- The power from -100 to 100, or -128 for float |
Set the motor target position in degrees Keyword arguments: port -- The motor port(s). PORT_A, PORT_B, PORT_C, and/or PORT_D. position -- The target position |
Set the motor target speed in degrees per second Keyword arguments: port -- The motor port(s). PORT_A, PORT_B, PORT_C, and/or PORT_D. dps -- The target speed in degrees per second |
Set the motor speed limit Keyword arguments: port -- The motor port(s). PORT_A, PORT_B, PORT_C, and/or PORT_D. power -- The power limit in percent (0 to 100), with 0 being no limit (100) dps -- The speed limit in degrees per second, with 0 being no limit |
Read a motor status
Keyword arguments:
port -- The motor port (one at a time). PORT_A, PORT_B, PORT_C, or PORT_D.
Returns a list:
flags -- 8-bits of bit-flags that indicate motor status:
bit 0 -- LOW_VOLTAGE_FLOAT - The motors are automatically disabled because the battery voltage is too low
bit 1 -- OVERLOADED - The motors aren't close to the target (applies to position control and dps speed control).
power -- the raw PWM power in percent (-100 to 100)
encoder -- The encoder position
dps -- The current speed in Degrees Per Second
|
Offset a motor encoder Keyword arguments: port -- The motor port(s). PORT_A, PORT_B, PORT_C, and/or PORT_D. offset -- The encoder offset Zero the encoder by offsetting it by the current position |
Read a motor encoder in degrees Keyword arguments: port -- The motor port (one at a time). PORT_A, PORT_B, PORT_C, or PORT_D. Returns the encoder position in degrees |
Reset the BrickPi. Set all the sensors' type to NONE, set the motors' speed to 0, and return control of the LED to the firmware. |
| Class Variable Details |
BPSPI_MESSAGE_TYPE
|
SENSOR_TYPE
|
SENSOR_STATE
|
SENSOR_CUSTOM
Flags for use with SENSOR_TYPE.CUSTOM
PIN1_9V
Enable 9V out on pin 1 (for LEGO NXT Ultrasonic sensor).
PIN5_OUT
Set pin 5 state to output. Pin 5 will be set to input if this flag is not set.
PIN5_STATE
If PIN5_OUT is set, this will set the state to output high, otherwise the state will
be output low. If PIN5_OUT is not set, this flag has no effect.
PIN6_OUT
Set pin 6 state to output. Pin 6 will be set to input if this flag is not set.
PIN6_STATE
If PIN6_OUT is set, this will set the state to output high, otherwise the state will
be output low. If PIN6_OUT is not set, this flag has no effect.
PIN1_ADC
Enable the analog/digital converter on pin 1 (e.g. for NXT analog sensors).
PIN6_ADC
Enable the analog/digital converter on pin 6.
|
SENSOR_I2C_SETTINGS
|
MOTOR_STATUS_FLAG
|
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Thu Apr 27 13:06:56 2017 | http://epydoc.sourceforge.net |