make conn port initialize the sensor on port
port as being an ultrasonic one.
val set : ?check_status:bool -> 'a t -> [ `Off | `Meas | `Meas_cont | `Event | `Reset | `Meas_interval of int | `Zero of int | `Scale_mul of int | `Scale_div of int ] -> unit Lwt.t
Ultrasonic.set us cmd set the state or parameters for the ultrasonic sensor
cmd may be:
`Off: turns the ultrasonic sensor off.
`Meas: single shot command. In this mode, the ultrasonic sensor will only make a new measurement every time the command byte is send to the sensor. The sensor will measure distances for up to 8 objects and save the distances within the
`Meas_contContinuous measurement command. This is the default mode, where the sensor continuously makes new measurement with the specified interval (see
`Event: Event capture command. Within this mode the sensor will measure whether any other ultrasonic sensors are within the vicinity. With this information a program can evaluate when it is best to make a new measurement which will not conflict with other ultrasonic sensors.
`Meas_interval t: set continuous measurment interval.
`Zero z: set the actual zero.
`Scale_mul m: set the actual scale factor.
`Scale_div d: set the actual scale divisor.
`Reset: resets the ultrasonic sensor.
val get : 'a t -> [ `Byte0 | `Byte1 | `Byte2 | `Byte3 | `Byte4 | `Byte5 | `Byte6 | `Byte7 | `Meas_interval | `Zero | `Scale_mul | `Scale_div ] -> int Lwt.t
Ultrasonic.get us var returns the content of the variable
var on the sensor (detailed underneath). All values are between 0 and 255. Communication errors will be reported by raising
Error Bus_error; your application should be ready to handle such exceptions.
`Byte7are the 8 variables containing the distances measured with the
`Meas_contcommand (in centimeters).
`Meas_intervalreturns the interval (in 0.01 sec) between two consecutive measurments when the sensor is in continuous measurment (command
`Zeroreturns the value of the actual zero (settable with the
`Scale_div) return the current scaling factor (resp. divisor). It is settable with the