Module Mindstorm_NXT.Motor

module Motor: sig .. end
Output ports.

type port 
The three motor ports (immutable). For more readability of your program, it is recommended you give appropriate aliases to the ports of interest at the beginning of your program, e.g. let motor_right = Mindstorm.NXT.Motor.a.
val a : port
The motor port A.
val b : port
The motor port B.
val c : port
The motor port C.
val all : port
Special value representing all 3 ports.
type regulation = [ `Idle | `Motor_speed | `Motor_sync ] 
Regulation mode.
type run_state = [ `Idle | `Ramp_down | `Ramp_up | `Running ] 
Specifies how to perform the transition to the new speed given in Mindstorm.NXT.Motor.state.

type state = {
   speed : int; (*Power set-point. Range: -100 .. 100. Values larger than 100 will be taken as 100 and values less than -100 will be takes as -100.*)
   motor_on : bool; (*if true, turns the motor on: enables pulse-width modulation (PWM) power according to speed.*)
   brake : bool; (*Use run/brake instead of run/float. "Braking" in this sense means that the output voltage is not allowed to float between active PWM pulses. Electronic braking improves the accuracy (and is necessary to see a rotation at small speeds) of motor output, but uses slightly more battery power.*)
   regulation : regulation; (*Turns on the chosen regulation.*)
   turn_ratio : int; (*Range: -100 .. 100. See Mindstorm.NXT.Motor.regulation.*)
   run_state : run_state; (*See Mindstorm.NXT.Motor.run_state.*)
   tach_limit : int; (*Number of degrees to rotate; 0: run forever. Range: 0 .. 4294967295 (unsigned 32 bits). See also Mindstorm.NXT.Motor.run_state.*)
The absolute value of speed is used as a percentage of the full power capabilities of the motor. The sign of speed specifies rotation direction. You must set some other properties appropriately for the speed set-point to have the desired effect: If not motor_on && not brake, motors are in COAST mode: motors connected to the specified port(s) will rotate freely.
val speed : ?tach_limit:int ->
?brake:bool ->
?sync:bool -> ?turn_ratio:int -> int -> state
speed s returns a state where speed is s, motor_on is true if and only if s <> 0, and run_state = `Running.
tach_limit : set the number of degrees to rotate. The movement is unfortunately not fully accurate. Default 0 which means "no limit".
brake : turns on brake. Default true.
sync : turn on `Motor_sync. Default false.
turn_ratio : set a turn-ratio. Default 0.
val set : ?check_status:bool ->
'a Mindstorm_NXT.conn ->
port -> state -> unit
set conn p st sets the state of the motor connected to the port p to st.
check_status : whether to check the status returned by the brick. Default: see Mindstorm.NXT.connect_bluetooth.
val get : 'a Mindstorm_NXT.conn ->
port -> state * int * int * int
get conn p returns (state, tach_count, block_tach_count, rotation_count) where
val reset_pos : ?check_status:bool ->
'a Mindstorm_NXT.conn -> ?relative:bool -> port -> unit
reset_pos conn p resets the rotation count (given by the rotation_count field of Mindstorm.NXT.Motor.get) of the motor connected to port p.
check_status : whether to check the status returned by the brick. Default: see Mindstorm.NXT.connect_bluetooth.
relative : if true, relative to the last movement, otherwise absolute position. Default: false.