sig
  type t
  type port = [ `S1 | `S2 | `S3 | `S4 ]
  type sensor_type =
      [ `Angle
      | `Custom
      | `Highspeed
      | `Light_active
      | `Light_inactive
      | `Lowspeed
      | `Lowspeed_9v
      | `No_sensor
      | `Reflection
      | `Sound_db
      | `Sound_dba
      | `Switch
      | `Temperature ]
  type mode =
      [ `Angle_steps
      | `Bool
      | `Celsius
      | `Fahrenheit
      | `Pct_full_scale
      | `Period_counter
      | `Raw
      | `Slope_mask
      | `Transition_cnt ]
  val set :
    ?check_status:bool ->
    'Mindstorm.conn ->
    Mindstorm.Sensor.port ->
    Mindstorm.Sensor.sensor_type -> Mindstorm.Sensor.mode -> unit
  type data = {
    sensor_type : Mindstorm.Sensor.sensor_type;
    mode : Mindstorm.Sensor.mode;
    valid : bool;
    raw : int;
    normalized : int;
    scaled : int;
  }
  val get :
    'Mindstorm.conn -> Mindstorm.Sensor.port -> Mindstorm.Sensor.data
  val reset_scaled :
    ?check_status:bool -> 'Mindstorm.conn -> Mindstorm.Sensor.port -> unit
  val get_status : 'Mindstorm.conn -> Mindstorm.Sensor.port -> int
  val write :
    ?check_status:bool ->
    'Mindstorm.conn ->
    Mindstorm.Sensor.port -> ?rx_length:int -> string -> unit
  val read : 'Mindstorm.conn -> Mindstorm.Sensor.port -> string
  module Ultrasonic :
    sig
      type t
      val make :
        'Mindstorm.conn ->
        Mindstorm.Sensor.port -> Mindstorm.Sensor.Ultrasonic.t
      val set :
        ?check_status:bool ->
        Mindstorm.Sensor.Ultrasonic.t ->
        [ `Event
        | `Meas
        | `Meas_cont
        | `Meas_interval of int
        | `Off
        | `Reset
        | `Scale_div of int
        | `Scale_mul of int
        | `Zero of int ] -> unit
      val get :
        Mindstorm.Sensor.Ultrasonic.t ->
        [ `Byte0
        | `Byte1
        | `Byte2
        | `Byte3
        | `Byte4
        | `Byte5
        | `Byte6
        | `Byte7
        | `Meas_interval
        | `Scale_div
        | `Scale_mul
        | `Zero ] -> int
      val get_state :
        Mindstorm.Sensor.Ultrasonic.t ->
        [ `Event | `Meas | `Meas_cont | `Off | `Reset ]
    end
end