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. | |
Provides access to the gyroscope. | |
keys | Provides access to the buttons on the body of the robot. |
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. |
Provides access to the accelerometer (class "Accelerometer").
brick.accelerometer();
brick.accelerometer();
Provides access to battery information (class "Battery").
brick.battery();
brick.battery();
Provides access to the color sensor by the camera (class "ColorSensor").
brick.colorSensor("video1");
brick.colorSensor("video1");
Provides access to the display of the robot (class "Display").
brick.display();
brick.display();
Provides access to the encoder on the specified port (class "Encoder").
brick.encoder(portName);brick.encoder("portName");
brick.encoder(portName);brick.encoder("portName");
As a parameter, you must specify the port.
brick.encoder(E1); // encoder call on port E1brick.encoder("E2"); // encoder call on port E2
brick.encoder(E1); # encoder call on port E1brick.encoder("E2"); # encoder call on port E2
Get a photo from the camera as an array of bytes.
brick.getStillImage();
brick.getStillImage();
Provides access to the gyroscope (class "Gyroscope").
brick.gyroscope();
brick.gyroscope();
Provides access to the buttons on the robot body (class "Keys").
brick.keys();
brick.keys();
Provides access to the LED on the robot body (class "Led").
brick.led();
brick.led();
Provides access to the line sensor by the camera (class "LineSensor").
brick.lineSensor();
brick.lineSensor();
Provides access to the motor (power or servomotor) on the specified port (class "Motor").
brick.motor(motorName);brick.motor("motorName");
brick.motor(motorName);brick.motor("motorName");
As a parameter, you must specify the port.
brick.motor(M1) // motor call on port M1brick.motor("M2") // motor call on port M2
brick.motor(M1) # motor call on port M1brick.motor("M2") # motor call on port M2
Provides access to the object sensor by the camera (class "ObjectSensor").
brick.objectSensor();
brick.objectSensor();
Play the audio file.
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.
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 the line (in Russian or English).
brick.say(string);
brick.say(string);
As a parameter, you must specify a string in English or Russian.
brick.say("Привет, я ТРИК");
brick.say("Привет, я ТРИК");
Provides access to the sensor on the specified port (class "Sensor").
brick.sensor(portName);brick.sensor("portName");
brick.sensor(portName);brick.sensor("portName");
As a parameter, you must specify the port.
brick.sensor(A1) // call a sensor on port A1brick.sensor("A2") // call a sensor on port A2
brick.sensor(A1) # call a sensor on port A1brick.sensor("A2") # call a sensor on port A2
Stops all motors and active sensors, and removes what is drawn on the display.
brick.stop();
brick.stop();