Brick Class

Definition

The main Brick class allowing low level access to motors and sensors

public class Brick : IDisposable
type Brick = class
    interface IDisposable
Public Class Brick
Implements IDisposable
Inheritance
Brick
Implements

Constructors

Brick(Byte, Int32, Int32)

Initialize the brick including SPI communication

Properties

BrickPi3Info

Stores all the information regarding the Brick This includes id, hardware and firmware versions

BrickPi3Voltage

Stores the voltage information

SpiAddress

used to store the SPI Address used mainly when multiple bricks in a raw or not the default SPI address up to 254 addresses supported

Methods

Dispose()

Reset the brick, stop the motors, release sensors

GetBoard()

Read the 20 charactor BrcikPi3 board name

GetFirmwareVersion()

Read the firmware version

GetHardwareVersion()

Read the hardware version

GetId()

Read the 128 - bit BrcikPi3 hardware serial number

GetManufacturer()

Read the 20 charactor BrickPi3 manufacturer name

GetMotorEncoder(Byte)

Read a motor encoder in degrees

GetMotorStatus(Byte)

Read a motor status

GetSensor(Byte)

Get the sensor data from a specific port 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

GetVoltage3V3()

Get the 3.3v circuit voltage

GetVoltage5V()

Get the 5v circuit voltage

GetVoltage9V()

Get the 9v circuit voltage

GetVoltageBatteryVcc()

Get the battery voltage

OffsetMotorEncoder(Byte, Int32)

Offset a motor encoder

SetAddress(Byte, String)

Set the SPI address of the BrickPi3

SetLed(Byte)

Set the Led intensity from 0 (off) to 100 (fully bright), 255 used to return the led to BrickPi3 management

SetMotorDps(Byte, Int32)

Set the motor target speed in degrees per second

SetMotorLimits(Byte, Byte, Int32)

Set the motor speed limit

SetMotorPosition(Byte, Int32)

Set the motor target position in degrees

SetMotorPositionKD(Byte, Byte)

Set the motor target position KD constant If you set KP higher, the motor will be more responsive to errors in position, at the cost of perhaps overshooting and oscillating. KD slows down the motor as it approaches the target, and helps to prevent overshoot. In general, if you increase kp, you should also increase KD to keep the motor from overshooting and oscillating.

SetMotorPositionKP(Byte, Byte)

Set the motor target position KP constant If you set KP higher, the motor will be more responsive to errors in position, at the cost of perhaps overshooting and oscillating. KP slows down the motor as it approaches the target, and helps to prevent overshoot. In general, if you increase KP, you should also increase KD to keep the motor from overshooting and oscillating.

SetMotorPower(Byte, Int32)

Set the motor power in percent

SetSensorType(Byte, SensorType, Int32[])

Set the sensor type

SpiRead16(SpiMessageType)

Read a 16 - bit value over SPI

SpiRead32(SpiMessageType)

Read a 32 - bit value over SPI

SpiTransferArray(Byte[])

Conduct a SPI transaction

SpiWrite16(SpiMessageType, Int32)

Send a 16 - bit value over SPI

SpiWrite24(SpiMessageType, Int32)

Send a 24 - bit value over SPI

SpiWrite32(SpiMessageType, Int32)

Send a 32 - bit value over SPI

SpiWrite8(SpiMessageType, Int32)

Send a 8 - bit value over SPI

Applies to