Clojure library for talking to the MCP342x family of A/D converters using I2C :
Relies on dvlopt/linux.i2c.
Read the API.
In short, without erorr handling :
(require '[dvlopt.linux.i2c :as i2c]
'[dvlopt.linux.i2c.mcp342x :as adc])
(with-open [^java.lang.AutoCloseable bus (i2c/bus "/dev/i2c-1")]
(i2c/select-slave bus
(adc/address true
false
true))
(adc/configure bus
{::adc/channel 2
::adc/mode :continuous
::adc/pga :x1
::adc/resolution :16-bit})
(adc/read-channel bus
:16-bit)
=> {::adc/channel 2
::adc/micro-volt 913000
::adc/mode :continuous
::adc/pga :x1
::adc/resolution :16-bit}
)
Copyright © 2017 Adam Helinski
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close