I need to write a program to communicate with the STM32(a kind of microcontroller) via Serial Port. Is there any library of OCaml to use Serial Port?
This is the third time where you ask if something exists in OCaml and response of this kind of question can be found in the OPAM website which has a list of all libraries/packages available in the OCaml ecosystem.
opam search in your shell can give you a response too.
Assuming the serial interface is connected to your computer and it shows up as a
/dev file you can simply open this file and use the
Unix library bundled with OCaml.
More precisely the terminal interface will allow you to setup to baud rate, parity, etc.
Here’s a program I wrote a long time ago that may help you to get started.
But I was on Windows.
Which serial, USB or COM? If the latter, then COM devices provide files in basically any directory, so instead of /dev/ttyX you could read COM[0…9].