- scp over files
- arm jdk
- nrepl jar
- clojure jar
- untar the arm jdk
- launch a clojure repl
jdk1.7.0_06/bin/java -Dfile.encoding=utf8 -cp clojure-1.5.0-master-SNAPSHOT.jar:tools.nrepl-0.2.0-beta8.jar clojure.main
- launch a nrepl server
- the nrepl server binds to 0.0.0.0 (all interfaces) by default
(use '[clojure.tools.nrepl.server :only (start-server stop-server)])
;=> nil
(defonce server (start-server :port 7888))
;=> #'user/server
- connect to the nrepl server you just launched with your nrepl
client
- the ip will depend on how you connect your bealgebone to the
network
- the port is an option passed in above
- nrepl.el doesn't seem to provide an easy way to connect to a
host that is not localhost, so I went in and changed "localhost"
to the ip of my bealgebone
- you can paste the following code in to nrepl to blink the led
(require '[clojure.java.io :as io])
;=> nil
;; set the pin to GPIO mode, if yout LED is getting some voltage
;; (weakly lit) this should turn it off completely
(with-open [f (io/output-stream "/sys/kernel/debug/omap_mux/gpmc_ad6")]
(.write f (.getBytes "0x7")))
;=> nil
;; if this file exists the pin has already been "exported"
(.exists (io/file "/sys/class/gpio/gpio38/direction"))
;=> false
(with-open [f (io/output-stream "/sys/class/gpio/export")]
(.write f (.getBytes "38")))
;=> nil
(.exists (io/file "/sys/class/gpio/gpio38/direction"))
;=> true
(with-open [f (io/output-stream "/sys/class/gpio/gpio38/direction")]
(.write f (.getBytes "out")))
;=> nil
;; set the pin high
(with-open [f (io/output-stream "/sys/class/gpio/gpio38/value")]
(.write f (.getBytes "1")))
;=> nil
(Thread/sleep 1000)
;=> nil
;; set the pin low
(with-open [f (io/output-stream "/sys/class/gpio/gpio38/value")]
(.write f (.getBytes "0")))
;=> nil
;; good hygiene
(with-open [f (io/output-stream "/sys/class/gpio/unexport")]
(.write f (.getBytes "38")))