package serial

  1. Overview
  2. Docs
Serial communication module

Install

Dune Dependency

Authors

Maintainers

Sources

v0.0.2.tar.gz
md5=2a7127969e230247bbc7ceb9d460ce43
sha512=524731c49018ed75978c7cdf6339adb2016a4e78b1ebcee45f946fee952bbd62a6e716d1a23595bd83c8e2044690ac4a0fcf27329fbade32183ed8d92238726c

Description

Published: 09 Jun 2020

README

OSerial

OCaml Serial Module

Installation

opam install serial

Usage

Create a Serial_config module

module Serial_config = struct
    let port = "/dev/ttyUSB0"
    let baud_rate = 115200
end

Open the port

module Serial0 = Serial.Make(Serial_config)

Supplied Functions The function returns are wrapped in Lwt.t, so please read up on Lwt should you be unfamiliar with the library.

read_line : unit -> string Lwt.t
write_line : string -> unit Lwt.t
set_baud_rate : int -> unit Lwt.t

Useful should you wish to change the baud rate after opening the connection.

wait_for_line : string -> unit Lwt.t

Usage: wait_for_line "READY". Currently waits forever if the keyword is not received.

io_loop : string option -> unit Lwt.t

Opens a two-way communication channel between stdin and the serial device. Usage: io_loop (Some "quit"). If None is supplied instead, does not exit for any keyword.

Dependencies (3)

  1. lwt >= "4.0.0"
  2. ocaml >= "4.08"
  3. dune >= "2.5"

Dev Dependencies

None

Used by

None

Conflicts

None