Object «brick»

This article is automatically translated from Russian by Google Translator.

The object "brick" represents the TRIK controller and provides access to the robot devices.

Method

Description

Provides access to the accelerometer.

Provides access to battery information.

Provides access to the color sensor by the camera.

Provides access to the display of the robot.

Provides access to the encoder on the specified port.

Get a photo from the camera as an array of bytes.

Provides access to the gyroscope.

Provides access to the buttons on the body of the robot.

Play the audio file.

Provides access to the LED on the body of the robot.

Provides access to the line sensor by the camera.

Provides access to the motor on the specified port.

Provides access to the object sensor by the camera.

Pronounce the string passed as a parameter (in Russian or English).

Provides access to the sensor on the specified port.

Stops all motors and active sensors, and removes what is drawn on the display.

accelerometer

Provides access to the accelerometer (class "Accelerometer").

Syntax

brick.accelerometer();

battery

Provides access to battery information (class "Battery").

Syntax

brick.battery();

colorSensor

Provides access to the color sensor by the camera (class "ColorSensor").

Syntax

brick.colorSensor("video1");

display

Provides access to the display of the robot (class "Display").

Syntax

brick.display();

encoder

Provides access to the encoder on the specified port (class "Encoder").

Syntax

brick.encoder(portName);
brick.encoder("portName");

As a parameter, you must specify the port.

Example

brick.encoder(E1); // encoder call on port E1
brick.encoder("E2"); // encoder call on port E2

getStillImage

Get a photo from the camera as an array of bytes.

Syntax

brick.getStillImage();

gyroscope

Provides access to the gyroscope (class "Gyroscope").

Syntax

brick.gyroscope();

keys

Provides access to the buttons on the robot body (class "Keys").

Syntax

brick.keys();

led

Provides access to the LED on the robot body (class "Led").

Syntax

brick.led();

lineSensor

Provides access to the line sensor by the camera (class "LineSensor").

Syntax

brick.lineSensor();

motor

Provides access to the motor (power or servomotor) on the specified port (class "Motor").

Syntax

brick.motor(motorName);
brick.motor("motorName");

As a parameter, you must specify the port.

Example

brick.motor(M1) // motor call on port M1
brick.motor("M2") // motor call on port M2

objectSensor

Provides access to the object sensor by the camera (class "ObjectSensor").

Syntax

brick.objectSensor();

playSound

Play the audio file.

Syntax

brick.playSound("filename");

As a parameter, you must specify the name of the file with an absolute path or the path relative to the folder trik on the controller.

Warning! The file must be pre-loaded on the controller.

Example

brick.playSound("media/sound.mp3"); // Play the sound.mp3 file in the media folder

say

Say the line (in Russian or English).

Syntax

brick.say(string);

As a parameter, you must specify a string in English or Russian.

Example

brick.say("Привет, я ТРИК");

sensor

Provides access to the sensor on the specified port (class "Sensor").

Syntax

brick.sensor(portName);
brick.sensor("portName");

As a parameter, you must specify the port.

Example

brick.sensor(A1) // call a sensor on port A1
brick.sensor("A2") // call a sensor on port A2

stop

Stops all motors and active sensors, and removes what is drawn on the display.

Syntax

brick.stop();

Last updated