Sensory Variables for the LEGO NXT Controller

This article is automatically translated from Russian by Google Translator.

In addition to constants, TRIK Studio has reserved variables that store the values of readings of the sensors connected to the corresponding ports.

These values can be assigned to variables and used in mathematical expressions.

Variable

Description

encoderA

encoderB encoderC

Encoder readings on ports A, B, or C, respectively.

sensor1

sensor2 sensor3 sensor4

Sensor readings on ports 1, 2, 3, 4 respectively.

buttonEnter buttonEscape buttonLeft buttonRight

State of the buttons on the robot body: "Enter", "Cancel", "Left", "Right" respectively.

Possible values:

0 - button is not pressed.

1 - button is pressed.

Warning! Only "Enter" and "Right" buttons are available in generation mode in C.