{"id":22066265,"url":"https://github.com/modlfo/firmata","last_synced_at":"2026-03-09T19:13:00.283Z","repository":{"id":28070960,"uuid":"31568086","full_name":"modlfo/firmata","owner":"modlfo","description":"Ocaml  library to control Firmata boards like Arduino","archived":false,"fork":false,"pushed_at":"2016-10-24T18:41:27.000Z","size":105,"stargazers_count":20,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-13T11:04:07.768Z","etag":null,"topics":["arduino","firmata","ocaml"],"latest_commit_sha":null,"homepage":null,"language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/modlfo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-02T22:58:45.000Z","updated_at":"2024-06-07T02:36:15.000Z","dependencies_parsed_at":"2022-07-08T10:51:52.811Z","dependency_job_id":null,"html_url":"https://github.com/modlfo/firmata","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/modlfo/firmata","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modlfo%2Ffirmata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modlfo%2Ffirmata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modlfo%2Ffirmata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modlfo%2Ffirmata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/modlfo","download_url":"https://codeload.github.com/modlfo/firmata/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modlfo%2Ffirmata/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30308886,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T17:35:44.120Z","status":"ssl_error","status_checked_at":"2026-03-09T17:35:43.707Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","firmata","ocaml"],"created_at":"2024-11-30T19:26:58.065Z","updated_at":"2026-03-09T19:13:00.264Z","avatar_url":"https://github.com/modlfo.png","language":"OCaml","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"# Firmata\nOcaml library to control Firmata boards like Arduino\n\nYou can find the complete list of API functions in the `firmata.mli` file.\n\nFor examples on how to use the library see `SimpleExample.ml` and `NonBlockingExample.ml`.\n\n\n### Building the library and the examples\n\n```\n$ ./configure\n$ make\n```\n\nBuild the documentation:\n\n```\n$make doc\n```\n\nAfter building the documentation you will find the reference for the API in firmata_api.docdir/Firmata.html.\n\n\nIf you want to install the library run:\n\n```\n$ make install\n```\n\n### IMPORTANT\n\nIf you install the library you have to pass a bunch of flags when linking your own program. Therefore I recommend modifying one of the existing examples and use the build system provided.\n\nIf you need to compile your own program here are a few examples:\n\nCompiling SimpleExample.native in OSX\n\n```\n$ ocamlbuild -use-ocamlfind -pkg firmata -lflags -cclib,-lstdc++,-cclib,-framework,-cclib,CoreFoundation,-cclib,-framework,-cclib,IOKit SimpleExample.native\n```\n\n### Using this library\n\n##### Connecting to your board\n\nThe first thing that you have to do is finding which port your board is connected. You can use the function `getSerialPortNames` to get a list of the ports available.\n\nOnce you know the name of your port use `openPort port_name` start the communication with the board.\n\nDepending on the board, it may take some time to initialize and respond. Use `update board ms` to process any incoming data. You can poll the status of the board by using `isReady board`.\n\n##### Getting information\n\nOnce the board is ready you can display the pin information by calling `printInformation board`. This will print a list of the pins and the capabilities. You can retrieve this information by calling `getPinInformation board` to get a list of all the pins. You can also use `getName` and `getVersion` to get more information about the board.\n\n##### Configuring \n\nNow you can start configuring the pins of the board. You can call `setPinMode board pin mode` to define how you want to use it.\n\nBefore reading values of you need to request data from the board. If you want to do it manually use `queryPinState board pin`. This will ask the board for the current status of the pin. The data will be available once the once the board answers back.\n\nYou can ask the board to send information about a pin periodically. To do so, you need first to define how often you want the data. This is done with the function `setSamplingRate board ms`. Regular Arduino boards are limited by the processor speed and the serial communication speed. Other boards like the Teensy 3.1 can communicate much faster. Once the sampling rate is set, you need to define which pin should periodically update. Use `reportDigitalPin board pin true` or `reportAnalogPin board pin false` for digital or analog pins correspondingly.\n\n##### Reading and writing values\n\nYou have to consider that you need to call the function `update board ms` to process the incoming data. This function will block `ms` milliseconds waiting for data. If you don't want the function to block call it with `ms` equal zero `update board 0`.\n\nTo read or write values from the digital pins use the functions `digitalWrite` and `digitalRead`. For analog inputs use `analogRead` and to control PWM signals or servos use `analogWrite`.\n\n### Contribute\n\n- Help to put this library in Opam\n- Make an Lwt wrapper\n- Create examples\n- Suggest improvements\n\n### Known issues\n\nDue to problems with Ocaml compiling and linking C++ code I can only build native executables.\n\n### Authors\n\n- Leonardo Laguna Ruiz (modlfo@gmail.com) : Ocaml library and bindings\n- Paul Stoffregen (paul@pjrc.com) : Serial port C++ code (code from https://github.com/firmata/firmata_test )\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodlfo%2Ffirmata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmodlfo%2Ffirmata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodlfo%2Ffirmata/lists"}