https://github.com/hanselmw/archytas
Firmata for Clojure
https://github.com/hanselmw/archytas
arduino firmata iot
Last synced: 2 months ago
JSON representation
Firmata for Clojure
- Host: GitHub
- URL: https://github.com/hanselmw/archytas
- Owner: hanselmw
- License: gpl-3.0
- Created: 2016-08-06T22:16:38.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-05-08T01:50:04.000Z (about 9 years ago)
- Last Synced: 2025-05-09T22:11:28.304Z (about 1 year ago)
- Topics: arduino, firmata, iot
- Language: Clojure
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# archytas
[](https://travis-ci.org/hanselmw/archytas)
**archytas** provides access to [Standard Firmata](http://archytas.org/) commands via Clojure/clojurescript
and then some extra functionalities.
This project is heavily based on [peterschwarz/clj-firmata](https://github.com/peterschwarz/clj-firmata), you could consider it as a fork of it.
## Usage
Add the following to your `project.clj` dependencies
```clojure
[archytas "0.1.0-SNAPSHOT"]
```
For Clojurescript usage, see [here](doc/clojurescript.md)
### Connect to a Board
Connecting to a board is a simple as
```clojure
(use 'archytas.core)
(def board (open-serial-board "ttyACM0"))
```
replacing `ttyACM0` with the name or path of the appropriate serial port,
arduinos tend to use that port name on linux.
An valid serial port of a connected arduino may be autodetected by passing `:auto-detect` Currently, this only works on Mac OS X and Linux.
### Communicating with the board.
Performing simple queries on the board will result in events placed onto the board's `core.async` event channel.
For example, calling will result in an event of type `:firmware-report` to be placed on the channel. I.e. the following would be true:
```clojure
(let [ch (event-channel board)
_ (query-firmware board)
event ( board
(set-pin-mode 3 :input)
(enable-digital-port-reporting 3 true))
```
This will result in the following events on the channel:
```clojure
(let [ch (event-channel board)
event (