English
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.
battery
Provides access to battery information.
Provides access to the color sensor by the camera.
display
Provides access to the display of the robot.
encoder
Provides access to the encoder on the specified port.
Get a photo from the camera as an array of bytes.
gyroscope
Provides access to the gyroscope.
keys
Provides access to the buttons on the body of the robot.
playSound
Play the audio file.
led
Provides access to the LED on the body of the robot.
Provides access to the line sensor by the camera.
motor
Provides access to the motor on the specified port.
Provides access to the object sensor by the camera.
say
Pronounce the string passed as a parameter (in Russian or English).
sensor
Provides access to the sensor on the specified port.
stop
Stops all motors and active sensors, and removes what is drawn on the display.

accelerometer

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

Syntax

JavaScript
Python
brick.accelerometer();
brick.accelerometer();

battery

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

Syntax

JavaScript
Python
brick.battery();
brick.battery();

colorSensor

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

Syntax

JavaScript
Python
brick.colorSensor("video1");
brick.colorSensor("video1");

display

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

Syntax

JavaScript
Python
brick.display();
brick.display();

encoder

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

Syntax

JavaScript
Python
brick.encoder(portName);
brick.encoder("portName");
brick.encoder(portName);
brick.encoder("portName");
As a parameter, you must specify the port.

Example

JavaScript
Python
brick.encoder(E1); // encoder call on port E1
brick.encoder("E2"); // encoder call on port E2
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

JavaScript
Python
brick.getStillImage();
brick.getStillImage();

gyroscope

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

Syntax

JavaScript
Python
brick.gyroscope();
brick.gyroscope();

keys

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

Syntax

JavaScript
Python
brick.keys();
brick.keys();

led

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

Syntax

JavaScript
Python
brick.led();
brick.led();

lineSensor

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

Syntax

JavaScript
Python
brick.lineSensor();
brick.lineSensor();

motor

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

Syntax

JavaScript
Python
brick.motor(motorName);
brick.motor("motorName");
brick.motor(motorName);
brick.motor("motorName");
As a parameter, you must specify the port.

Example

JavaScript
Python
brick.motor(M1) // motor call on port M1
brick.motor("M2") // motor call on port M2
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

JavaScript
Python
brick.objectSensor();
brick.objectSensor();

playSound

Play the audio file.

Syntax

JavaScript
Python
brick.playSound("filename");
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

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

say

Say the line (in Russian or English).

Syntax

JavaScript
Python
brick.say(string);
brick.say(string);
As a parameter, you must specify a string in English or Russian.

Example

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

sensor

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

Syntax

JavaScript
Python
brick.sensor(portName);
brick.sensor("portName");
brick.sensor(portName);
brick.sensor("portName");
As a parameter, you must specify the port.

Example

JavaScript
Python
brick.sensor(A1) // call a sensor on port A1
brick.sensor("A2") // call a sensor on port A2
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

JavaScript
Python
brick.stop();
brick.stop();
Export as PDF
Copy link
On this page
accelerometer
battery
colorSensor
display
encoder
getStillImage
gyroscope
keys
led
lineSensor
motor
objectSensor
playSound
say
sensor
stop