Michael Collins

NAME

LEGO::NXT::Constants - Low-level constants for the Direct Commands API.

SYNOPSIS

  use LEGO::NXT::Constants;

DESCRIPTION

This module exports a bunch of constants in to your namespace for you to use with the various low-level methods in the LEGO::NXT module.

CONSTANTS

All of the following constants are exported in to your namespace by default.

RET and NORET

For each request of the NXT, you must specify whether you want the NXT to send a return value.

 $NXT_RET
 $NXT_NORET

Use $NXT_RET only when you really need a return value as it does have some overhead because it has do do a second request to retrieve response data from NXT and then parses that data.

IO Port

  $NXT_SENSOR1
  $NXT_SENSOR2
  $NXT_SENSOR3
  $NXT_SENSOR4
  
  $NXT_MOTOR_A
  $NXT_MOTOR_B
  $NXT_MOTOR_C
  $NXT_MOTOR_ALL

Motor Control

Output mode:

  $NXT_MOTOR_ON
  $NXT_BRAKE
  $NXT_REGULATED

Output regulation modes:

  $NXT_REGULATION_MODE_IDLE
  $NXT_REGULATION_MODE_MOTOR_SPEED
  $NXT_REGULATION_MODE_MOTOR_SYNC

Output run states:

  $NXT_MOTOR_RUN_STATE_IDLE
  $NXT_MOTOR_RUN_STATE_RAMPUP
  $NXT_MOTOR_RUN_STATE_RUNNING
  $NXT_MOTOR_RUN_STATE_RAMPDOWN

Sensor Type

  $NXT_NO_SENSOR
  $NXT_SWITCH
  $NXT_TEMPERATURE
  $NXT_REFLECTION
  $NXT_ANGLE
  $NXT_LIGHT_ACTIVE
  $NXT_LIGHT_INACTIVE
  $NXT_SOUND_DB
  $NXT_SOUND_DBA
  $NXT_CUSTOM
  $NXT_LOW_SPEED
  $NXT_LOW_SPEED_9V
  $NXT_NO_OF_SENSOR_TYPES

Sensor Mode

  $NXT_RAW_MODE
  $NXT_BOOLEAN_MODE
  $NXT_TRANSITION_CNT_MODE
  
  $NXT_PERIOD_COUNTER_MODE
  $NXT_PCT_FULL_SCALE_MODE
  
  $NXT_CELSIUS_MODE
  $NXT_FAHRENHEIT_MODE
  
  $NXT_ANGLE_STEPS_MODE
  $NXT_SLOPE_MASK
  $NXT_MODE_MASK

Op Codes

Generally you will not need to use these constants since LEGO::NXT provides easy to use wrappers around all of these actions.

  $NXT_START_PROGRAM
  $NXT_STOP_PROGRAM
  $NXT_PLAY_SOUND_FILE
  $NXT_PLAY_TONE
  $NXT_SET_OUTPUT_STATE
  $NXT_SET_INPUT_MODE
  $NXT_GET_OUTPUT_STATE
  $NXT_GET_INPUT_VALUES
  $NXT_RESET_SCALED_INPUT_VALUE
  $NXT_MESSAGE_WRITE
  $NXT_RESET_MOTOR_POSITION
  $NXT_GET_BATTERY_LEVEL
  $NXT_STOP_SOUND_PLAYBACK
  $NXT_KEEP_ALIVE
  $NXT_LSGET_STATUS
  $NXT_LSWRITE
  $NXT_LSREAD
  $NXT_GET_CURRENT_PROGRAM_NAME
  $NXT_MESSAGE_READ

SYS OPCODES

$NXT_SYS_OPEN_READ $NXT_SYS_OPEN_WRITE $NXT_SYS_READ $NXT_SYS_WRITE $NXT_SYS_CLOSE $NXT_SYS_DELETE $NXT_SYS_FIND_FIRST $NXT_SYS_FIND_NEXT $NXT_SYS_GET_FIRMWARE_VERSION $NXT_SYS_OPEN_WRITE_LINEAR $NXT_SYS_OPEN_READ_LINEAR $NXT_SYS_OPEN_WRITE_DATA $NXT_SYS_OPEN_APPEND_DATA $NXT_SYS_BOOT $NXT_SYS_SET_BRICK_NAME $NXT_SYS_GET_DEVICE_INFO $NXT_SYS_DELETE_USER_FLASH $NXT_SYS_POLL_COMMAND_LENGTH $NXT_SYS_POLL_COMMAND $NXT_SYS_BLUETOOTH_FACTORY_RESET

AUTHOR

Michael W. Collins <michaelcollins@ivorycity.com>

CONTRIBUTORS

Aran Deltac <bluefeet@cpan.org>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.