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
  • button
  • buttonWasPressed
  • connected
  • disconnect
  • isPadPressed
  • pad
  • padX
  • padY
  • padUp
  • reset
  • wheel
  • wheelEvent

Was this helpful?

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

Object «gamepad»

PreviousObject «mailbox»NextObject «Threading»

Last updated 4 years ago

Was this helpful?

This article is automatically translated from Russian by Google Translator.

Serves to work with the programmable control panel "".

Method

Description

Returns true if a button with the specified number was pressed on the remote control.

Returns whether the control area on the remote control is currently pressed.

If the specified control area on the remote is pressed, returns the current x-coordinate of the press.

If the specified control area on the remote is pressed, returns the current y-coordinate of the press.

Sent when the user moves his finger away from the control area with the specified number.

Resets the memorized events from the remote control.

If "steering" (events from the device's accelerometer) is enabled on the remote control, it returns the current remote control tilt.

Sent when the remote control has the "steering wheel" (events from the device's accelerometer) on and the user has turned the device.

Signal

Description

Sent when the user has pressed one of the five buttons at the bottom of the remote control.

Sent when the remote control is connected to the robot.

It is sent when the remote control is turned off.

Sent when the user taps or moves their finger over the control area on the remote.

button

Sent when the user has pressed one of the five buttons at the bottom of the remote control.

buttonWasPressed

Returns true if a button with the specified number was pressed on the remote control. Resets the memorized press for this button.

Syntax

gamepad.buttonWasPressed(buttonNumber);
gamepad.buttonWasPressed(buttonNumber);

As a parameter, you must specify the number of the button - from 1 to 5.

Example

gamepad.buttonWasPressed(5);
gamepad.buttonWasPressed(5);

connected

Sent when the remote control is connected to the robot.

disconnect

It is sent when the remote control is turned off.

isPadPressed

Returns whether the control area on the remote control is currently pressed. The control areas are numbered 0 and 1.

Syntax

gamepad.isPadPressed(padId);
gamepad.isPadPressed(padId);

As a parameter, you must specify the number of the control area - 0 or 1.

Example

gamepad.isPadPressed(1);
gamepad.isPadPressed(1);

pad

Sent when the user taps or moves their finger over the control area on the remote.

padX

If the specified control area on the remote is pressed, returns the current x-coordinate of the press.

Syntax

gamepad.padX(padId);
gamepad.padX(padId);

As a parameter, you must specify the number of the padId control area.

padY

If the specified control area on the remote is pressed, returns the current y-coordinate of the press.

Syntax

gamepad.padY(padId);
gamepad.padY(padId);

As a parameter, you must specify the number of the padId control area.

padUp

Sent when the user moves his finger away from the control area with the specified number.

Syntax

gamepad.padUp.connect( function(padId, x, y) { brick.stop(); });
gamepad.padUp.connect(lambda padId, x, y: brick.stop());

Parameters:

  • padId — control area number.

  • x, y — the coordinates of the last known click from -100 to 100. The coordinate (-100, -100) corresponds to the upper left corner of the control area.

reset

Resets the memorized events from the remote control.

Syntax

gamepad.reset();
gamepad.reset();

wheel

If "steering" (events from the device's accelerometer) is enabled on the remote control, it returns the current remote control tilt.

Tilt is coded from -100 to 100, with -100 being the leftmost "rudder" position and 100 being the rightmost position.

Syntax

gamepad.wheel();
gamepad.wheel();

wheelEvent

Sent when the remote control has the "steering wheel" (events from the device's accelerometer) on and the user has turned the device.

Syntax

gamepad.wheelEvent.connect( function(percent) { brick.motor("E1").setPower(percent); });
gamepad.wheelEvent.connect(lambda percent: brick.motor("E1").setPower(percent));

As a parameter it is necessary to specify a number from -100 to 100, -100 corresponds to the leftmost position of the "rudder", 100 - to the rightmost position.

TRIK Gamepad
buttonWasPressed
isPadPressed
padX
padY
padUp
reset
wheel
wheelEvent
button
connected
disconnect
pad