An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# archytas

[![Build Status](https://travis-ci.org/hanselmw/archytas.svg?branch=master)](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 (