Clojure library for talking to the MCP342x family of A/D converters using I2C :
Relies on helins/linux.i2c.
This is an overview.
The detailed API is available on Cljdoc.
In short, without error handling :
(require '[helins.linux.i2c :as i2c]
'[helins.linux.i2c.mcp342x :as mcp342x])
(with-open [bus (i2c/bus "/dev/i2c-1")]
(i2c/select-slave bus
(mcp342x/address true
false
true))
(mcp342x/configure bus
{:mcp342x/channel 2
:mcp342x/mode :continuous
:mcp342x/pga :x1
:mcp342x/resolution :16-bit})
(mcp342x/read-channel bus
:16-bit)
=> {:mcp342x/channel 2
:mcp342x/micro-volt 913000
:mcp342x/mode :continuous
:mcp342x/pga :x1
:mcp342x/resolution :16-bit})
Copyright © 2017 Adam Helinski
Licensed under the term of the Mozilla Public License 2.0, see LICENSE.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close