Skip to content

Commit

Permalink
release 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
peterschwarz committed Apr 16, 2014
1 parent 361b81c commit 3c74200
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Add the following to your `project.clj`

[clj-firmata 1.0.0]
[clj-firmata 1.1.0]

### Connect to a Board

Expand Down Expand Up @@ -53,23 +53,23 @@ The above will set the brightness of an LED on pin 11 to maximum brightness
The Firmata protocol provides several ways of receiving events from the board. The first is via an event channel:

(let [ch (event-channel board)]
; ...
; ...
; take events from the channel
; ...
; Then, when you're done, you should clean up:
(release-event-channel board ch))

The channels have the same buffer size as the board is configured with on `open-board`.

The protocol also provides a `core.async` publisher, which publishes events based on `[:event-type :pin]`. This can be used in the standard fashion:

(let [sub-ch (chan)]
(sub (event-publisher board) [:digital-msg 3] sub-ch)
(go (loop
(go (loop
(when-let [event (<! sub-ch)]
; ... do some stuff
(recur)))))

To enable digital pin reporting:

(-> board
Expand All @@ -86,7 +86,7 @@ This will result in the following events on the channel:

For convenience, the `firmata.receiver` namspace provides the function `on-digital-event`, which may be used to filter events with the `:digital-msg` type and to a specific pin. For example:

(def receiver (on-digital-event board 3
(def receiver (on-digital-event board 3
#(if (= :high (:value %)) "Pressed" "Released")))

This receiver can be stopped like so:
Expand All @@ -105,7 +105,7 @@ will result in the following events on the channel:
(is (= 0 (:pin event)))
(is (= 1000 (:value event)))

Like `on-digital-event`, there is an `on-analog-event` which will provide the events to a particular analog pin.
Like `on-digital-event`, there is an `on-analog-event` which will provide the events to a particular analog pin.


### Close the connection to a Board
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject clj-firmata "1.0.1-SNAPSHOT"
(defproject clj-firmata "1.1.0"
:description "clj-firmata provides access to Standard Firmata (http://firmata.org/) commands via clojure"
:url "https://github.com/peterschwarz/clj-firmata"
:license {:name "Eclipse Public License"
Expand Down

0 comments on commit 3c74200

Please sign in to comment.