LogoLogo
TRIK StudioTRIKLego EV3Lego NXT
English
English
  • TRIK help
  • TRIK Studio
    • About TRIK Studio
      • How to find out the version of TRIK Studio
    • Getting started and creating a project
    • TRIK Studio interface
      • TRIK Studio main menu
      • Working with graphs
      • How to open robot settings
      • How to change TRIK Studio interface language
    • TRIK Studio settings
    • 2D model
      • 2D model tuning
      • Adding restrictions to the 2D Model
        • Restrictions setting examples
    • Visual programming
      • Adding and removing blocks
      • Common blocks
      • Links between blocks
      • Syntax of expressions in the blocks
        • TRIK Studio language types
          • Array
        • TRIK Studio language tokens
        • TRIK Studio language operators
        • Constants
        • Sensor variables
        • Built-in functions
      • Property editing
      • Subprograms
    • Textual programming
    • Exercises
    • External tools
      • PuTTY
      • WinSCP
    • TRIK Studio shortcuts
    • Antivirus conflicts
      • Avast antivirus blocks TRIK Studio. What to do?
  • TRIK Studio Junior
    • About TRIK Studio Junior
      • How to find out the version of TRIK Studio Junior
    • Getting started and creating a project in TRIK Studio Junior
    • TRIK Studio Junior interface
      • How do I replace the "Character movement" image?
    • TRIK Studio Junior settings
    • Visual programming in TRIK Studio Junior
      • Adding and removing blocks in TRIK Studio Junior
      • Blocks in TRIK Studio Junior
      • Links between blocks in TRIK Studio Junior
      • Syntax of expressions in the blocks in TRIK Studio Junior
      • Property editing in TRIK Studio Junior
      • Subprograms in TRIK Studio Junior
    • Exercises in TRIK Studio Junior
  • INTEGRATIONS
    • PyCharm
      • Running a 2D model in TRIK Studio from PyCharm
    • Sublime Text
      • Running a 2D model in TRIK Studio from Sublime Text
      • Uploading programs to several TRIK robots from Sublime Text
    • VSCode
      • Running a 2D model in TRIK Studio from VSCode
      • Uploading programs to several TRIK robots from VSCode
  • TRIK controller
    • About the TRIK controller
      • Screenshot of the TRIK controller screen
    • TRIK controller firmware
      • How to find out the firmware version of the TRIK controller?
    • TRIK controller menu
    • Connecting to the TRIK controller via Wi-Fi
      • Connecting the TRIK controller to a computer and smartphone
      • Connecting the TRIK controller to TRIK Studio
      • Interaction of TRIK controllers
        • An example of solving a problem on the interaction of two robots
    • Connecting to the TRIK controller using UART
    • Launching and uploading programs to the TRIK controller
    • Programming TRIK with the visual programming language
      • TRIK specific blocks
      • Sensory variables for the TRIK controller
    • TRIK controller programming in Python and JavaScript
      • Object «brick»
        • Class «accelerometer»
        • Class «battery»
        • Class «colorSensor»
        • Class «display»
        • Class «encoder»
        • Class «gyroscope»
        • Class «keys»
        • Class «led»
        • Class «lineSensor»
        • Class «motor»
        • Class «objectSensor»
        • Class «sensor»
      • Object «script»
      • Object «mailbox»
      • Object «gamepad»
      • Object «Threading»
      • Function getPhoto
      • Function include
    • TRIK controller web interface
    • Connecting devices to TRIK and working with them
      • Connecting and working with the video module
      • Testing devices connected to the TRIK controller
      • Configuring the operation of a USB camera with a TRIK controller
      • Capturing images with TRIK camera and using them in TRIK Studio
      • Working with battery and charger
  • LEGO EV3 Controller
    • About LEGO EV3
    • Connecting a LEGO EV3 Controller to TRIK Studio
    • LEGO EV3 specific blocks
    • Sensory Variables for the LEGO EV3 Controller
    • Launching and uploading programs to the LEGO EV3
  • LEGO NXT Controller
    • About LEGO NXT
    • LEGO NXT Controller Firmware
    • Connecting a LEGO NXT Controller to TRIK Studio
    • LEGO NXT specific blocks
    • Sensory Variables for the LEGO NXT Controller
    • LEGO NXT C Programming
    • Launching and uploading programs to the LEGO NXT
  • Quadcopter Geoscan Pioneer
    • About quadcopter Geoscan Pioneer
    • Geoscan Pioneer specific blocks
  • TRIK Gamepad
    • About TRIK Gamepad
      • TRIK Gamepad App
      • TRIK Gamepad Utility
    • Robot control from the remote control
  • Feedback
    • Actions in case of TRIK Studio or TRIK controller malfunction
    • Ask a Question
    • trikset.com
Powered by GitBook
On this page
  • accelerometer
  • battery
  • colorSensor
  • display
  • encoder
  • getStillImage
  • gyroscope
  • keys
  • led
  • lineSensor
  • motor
  • objectSensor
  • playSound
  • say
  • sensor
  • stop

Was this helpful?

Export as PDF
  1. TRIK controller
  2. TRIK controller programming in Python and JavaScript

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

Syntax

brick.accelerometer();
brick.accelerometer();

battery

Syntax

brick.battery();
brick.battery();

colorSensor

Syntax

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

display

Syntax

brick.display();
brick.display();

encoder

Syntax

brick.encoder(portName);
brick.encoder("portName");
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
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();
brick.getStillImage();

gyroscope

Syntax

brick.gyroscope();
brick.gyroscope();

keys

Syntax

brick.keys();
brick.keys();

led

Syntax

brick.led();
brick.led();

lineSensor

Syntax

brick.lineSensor();
brick.lineSensor();

motor

Syntax

brick.motor(motorName);
brick.motor("motorName");
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
brick.motor(M1) # motor call on port M1
brick.motor("M2") # motor call on port M2

objectSensor

Syntax

brick.objectSensor();
brick.objectSensor();

playSound

Play the audio file.

Syntax

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

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

brick.say(string);
brick.say(string);

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

Example

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

sensor

Syntax

brick.sensor(portName);
brick.sensor("portName");
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
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();
brick.stop();
PreviousTRIK controller programming in Python and JavaScriptNextClass «accelerometer»

Last updated 4 years ago

Was this helpful?

Provides access to the accelerometer (class "").

Provides access to battery information (class "").

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

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

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

Provides access to the gyroscope (class "").

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

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

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

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

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

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

Accelerometer
Battery
ColorSensor
Display
Encoder
Gyroscope
Keys
Led
LineSensor
Motor
ObjectSensor
Sensor
accelerometer
battery
colorSensor
display
encoder
getStillImage
gyroscope
keys
playSound
led
lineSensor
motor
objectSensor
say
sensor
stop