Skip to content

Commit

Permalink
fix led-set-all and add usage of led-frame to README
Browse files Browse the repository at this point in the history
  • Loading branch information
philandstuff committed Apr 19, 2012
1 parent 17d8536 commit e6e67d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 8 additions & 1 deletion README.md
Expand Up @@ -14,7 +14,14 @@ Interact with the Novation Launchpad from within Clojure.
(led-set grid 1 2 3) ; yellow
(led-set grid 1 2 0) ; off
(on-action grid :handler-name (fn [event x y] (led-set grid x y
(if (= :press event) 1 0))))
(if (= :press event) 1 0))))

;; Chessboard pattern
(led-frame lp
(into {}
(for [x (range 8)
y (range 8)]
[[x y] (if (zero? (rem (+ x y) 2)) 1 2) ] )))

;; Interact with the peripheral circular buttons using the
;; MetaKeys protocol:
Expand Down
6 changes: 5 additions & 1 deletion src/overtone/device/launchpad.clj
Expand Up @@ -153,7 +153,11 @@
(on-action [this key f] ; currently ignoring key
(swap! callbacks assoc :grid-handler f))
(led-set-all [this colour]
(led-frame this (repeat 8 (repeat 8 colour))))
(led-frame this
(into {[0 0] 1}
(for [y (range 8)
x (range 8)]
[[x y] colour]))))
(led-set [this x y colour]
(midi-note-on launchpad-out (coords->midi-note x y) (colour-single colour palette)))
(led-frame [this leds]
Expand Down

0 comments on commit e6e67d2

Please sign in to comment.