Created
June 5, 2012 21:18
-
-
Save ardumont/2878047 to your computer and use it in GitHub Desktop.
blinking the led
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def short-pulse 100) | |
(def long-pulse 250) | |
(def letter-delay 500) | |
;; pin number | |
(def pin-led 13) | |
;; functions | |
(defn blink | |
"Given a board and time, make the led blink a given time" | |
[board time] | |
(digital-write board pin-led HIGH) | |
(Thread/sleep time) | |
(digital-write board pin-led LOW) | |
(Thread/sleep time)) | |
(defn blink-letter | |
"Given a letter, blink according to the sequence of 0 (short pulse) and 1 (long pulse)" | |
[board letter] | |
(doseq [i letter] | |
(if (= i 0) | |
(blink board short-pulse) | |
(blink board long-pulse))) | |
(Thread/sleep letter-delay)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment