LEGO Mindstorms EV3


Output Library
Byte codes:

opOUTPUT_GET_TYPE     LAYER   NO       *TYPE                                   // Get output device type
opOUTPUT_SET_TYPE     LAYER   NO       TYPE                                    // Set output device type
opOUTPUT_RESET        LAYER   NOS                                              // Reset position  (POS=0)
opOUTPUT_STOP         LAYER   NOS      BRAKE                                   // Stop outputs    (brake or coast)
opOUTPUT_POWER        LAYER   NOS      POWER                                   // Set power       (suspend regulation and positioning)
opOUTPUT_SPEED        LAYER   NOS      SPEED                                   // Set speed (relative to polarity - enables regulation if tacho)
opOUTPUT_START        LAYER   NOS                                              // Starts outputs from present values
opOUTPUT_POLARITY     LAYER   NOS      POL                                     // Set polarity    (0=toggle)
opOUTPUT_READ         LAYER   NOS      *SPEED *STEPS                           // Read actual speed and steps from last reset
opOUTPUT_TEST         LAYER   NOS      *Busy                                   //
opOUTPUT_READY        LAYER   NOS                                              // Wait for new action completed or overruled
opOUTPUT_POSITION     LAYER   NOS      POS                                     // Set position    (absolute from last reset)

opOUTPUT_STEP_POWER   LAYER   NOS      POWER   STEP1   STEP2   STEP3   BRAKE   // Set all parameters, start if not started and power != 0
opOUTPUT_TIME_POWER   LAYER   NOS      POWER   TIME1   TIME2   TIME3   BRAKE   // Set all parameters, start if not started and power != 0
opOUTPUT_STEP_SPEED   LAYER   NOS      SPEED   STEP1   STEP2   STEP3   BRAKE   // Set all parameters, start if not started and power != 0
opOUTPUT_TIME_SPEED   LAYER   NOS      SPEED   TIME1   TIME2   TIME3   BRAKE   // Set all parameters, start if not started and power != 0
opOUTPUT_STEP_SYNC    LAYER   NOS      SPEED   TURN    STEP    BRAKE           // Set all parameters, start if not started and power != 0
opOUTPUT_TIME_SYNC    LAYER   NOS      SPEED   TURN    TIME    BRAKE           // Set all parameters, start if not started and power != 0
opOUTPUT_CLR_COUNT    LAYER   NOS                                              // Clears the tacho count used when in sensor mode
opOUTPUT_GET_COUNT    LAYER   NO       *STEPS                                  // Gets the tacho count used in sensor mode


Parameters:
                      LAYER   DATA8    [0..3]              // USB chain layer                      (0=Master, 1=Slave1)
                      NO      DATA8    [0..3]              // Output port number
                      TYPE    DATA8    [0..255]            // Output device type                   (0=none)
                      NOS     DATA8    [0x00..0x0F]        // Bit field representing output 1 to 4 (0x01, 0x02, 0x04, 0x08)
                      BRAKE   DATA8    [0..1]              // Output state after stop              (0=Coast,  1=Brake)
                      POWER   DATA8    [+-0..100%]         // Power relative to polarity
                      SPEED   DATA8    [+-0..100%]         // Speed relative to polarity           (0->BRAKE=1)
                      STEPS   DATA32   [+-0..MAX]          // Steps in degrees                     (0=infinite)
                      POL     DATA8    [+-0..1]            // Polarity +-1, 0=toggle               (multiplied to SPEED and POWER)
                      POS     DATA32   [+-0..MAX]          // Steps in degrees                     (0=infinite)
                      STEP1   DATA32   [0..MAX]            // Steps used to ramp up
                      STEP2   DATA32   [0..MAX]            // Steps used for constant speed
                      STEP3   DATA32   [0..MAX]            // Steps used to ramp down
                      TIME1   DATA32   [0..MAX]            // Time [mS] to ramp up
                      TIME2   DATA32   [0..MAX]            // Time [mS] for constant speed
                      TIME3   DATA32   [0..MAX]            // Time [mS] to ramp down
                      TURN    DATA16   [-200..200]         // Turn ratio between two syncronized motors
*/

/*
 * SYNCRONIZATION:
 *
 *  Speed -100 to +100 is move forward or move backwards
 *  Turn ratio is how tight you turn and to what direction you turn
 *   - 0 value is moving straight forward
 *   - Negative values turns to the left
 *   - Positive values turns to the right
 *   - Value -100 stops the left motor
 *   - Value +100 stops the right motor
 *   - Values less than -100 makes the left motor run the opposite
 *     direction of the right motor (Spin)
 *   - Values greater than +100 makes the right motor run the opposite
 *     direction of the left motor (Spin)
 *
 *  Example: opOUTPUT_TIME_SYNC(0, 10, 100, 50, 10000,1)
 *
 *  0     = Layer
 *  10    = Motor bit field - Motor B and D
 *  100   = Motor speed     - Motor B will run at speed 100 (because ratio is positive)
 *  10    = Turn ratio      - Motor D will run at speed 50
 *  10000 = time in mS      - Motors will run for 10 sec.
 *  1     = Brake bit       - When 10 sec. has elapsed then brake both motors
 *
 *
 *  Example: opOUTPUT_TIME_SYNC(0, 10, 100, 150, 10000,1)
 *
 *  0     = Layer
 *  10    = Motor bit field - Motor B and D
 *  100   = Motor speed     - Motor B will run at speed 100 (because ratio is positive)
 *  10    = Turn ratio      - Motor D will run at speed -50
 *  10000 = time in mS      - Motors will run for 10 sec.
 *  1     = Brake bit       - When 10 sec. has elapsed then brake both motors
 *
 *
 *  Example: opOUTPUT_TIME_SYNC(0, 10, 100, -50, 10000,1)
 *
 *  0     = Layer
 *  10    = Motor bit field - Motor B and D
 *  100   = Motor speed     - Motor B will run at speed  50 (because ratio is positive)
 *  10    = Turn ratio      - Motor D will run at speed 100
 *  10000 = time in mS      - Motors will run for 10 sec.
 *  1     = Brake bit       - When 10 sec. has elapsed then brake both motors
 *
 *
 *  Example: opOUTPUT_TIME_SYNC(0, 10, 200, -150, 10000,1)
 *
 *  0     = Layer
 *  10    = Motor bit field - Motor B and D
 *  100   = Motor speed     - Motor B will run at speed -50 (because ratio is positive)
 *  10    = Turn ratio      - Motor D will run at speed 100
 *  10000 = time in mS      - Motors will run for 10 sec.
 *  1     = Brake bit       - When 10 sec. has elapsed then brake both motors
 *
 *\

LEGO® Robotics Firmware Documentation
Confidential Information © 2013 The LEGO Group