Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/helins/linux.i2c.mcp342x.clj
Talking to the MCP342x family of ADC via I2C from Clojure JVM
https://github.com/helins/linux.i2c.mcp342x.clj
adc clojure i2c io iot jvm
Last synced: 23 days ago
JSON representation
Talking to the MCP342x family of ADC via I2C from Clojure JVM
- Host: GitHub
- URL: https://github.com/helins/linux.i2c.mcp342x.clj
- Owner: helins
- License: mpl-2.0
- Created: 2018-03-03T12:34:53.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2021-03-24T10:53:17.000Z (over 3 years ago)
- Last Synced: 2024-07-10T20:54:22.737Z (4 months ago)
- Topics: adc, clojure, i2c, io, iot, jvm
- Language: Clojure
- Homepage:
- Size: 2.49 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Linux.I2C.MCP342X, driver for A/D
[![Clojars
Project](https://img.shields.io/clojars/v/io.helins/linux.i2c.mcp342x.svg)](https://clojars.org/io.helins/linux.i2c.mcp342x)[![Cljdoc](https://cljdoc.org/badge/io.helins/linux.i2c.mcp342x)](https://cljdoc.org/d/io.helins/linux.i2c.mcp342x)
Clojure library for talking to the MCP342x family of A/D converters using
[I2C](https://en.wikipedia.org/wiki/I%C2%B2C) :- MCP3421
- MCP3422
- MCP3423
- MCP3424
- MCP3425
- MCP3426
- MCP3427
- MCP3428Relies on [helins/linux.i2c](https://github.com/helins/linux.i2c.clj).
## Usage
This is an overview.
The [detailed API is available on Cljdoc](https://cljdoc.org/d/io.helins/linux.i2c.mcp342x).
In short, without error handling :
```clj
(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})
```## License
Copyright © 2017 Adam Helinski
Licensed under the term of the Mozilla Public License 2.0, see LICENSE.