Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Small library for the MCP3008 microchip ADC

License

NotificationsYou must be signed in to change notification settings

pharo-iot/Pharo-MCP3008

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Small library for the MCP3008 microchip ADChttps://cdn-shop.adafruit.com/datasheets/MCP3008.pdf

Values are physically read and converted by the mcp320x driver. Values are stored in files and updated depending on the configured refresh rate. The values can be read in /sys/bus/iio/devices/iio

The library is just a helper to access the different channels of the MCP3008, by reading the corresponding file contents in /sys/bus/iio/devices/iio. The recovered values are strings, but are not converted to numbers by the library.

Quick start

This code has been implemented and tested followinghttp://www.jumpnowtek.com/rpi/Using-mcp3008-ADCs-with-Raspberry-Pis.htmlThe mpc320x driver is shipped with the last versions of Raspbian.

The setup uses a DTS that can be found herehttps://github.com/raspberrypi/linux/blob/rpi-4.4.y/arch/arm/boot/dts/overlays/mcp3008-overlay.dts and must be copied in boot/dts/overlays/

The Pharo-MCP3008 can be loaded and used after the setup is complete.

Usage

A simple example can be executed in the MCP3008Example class:

MCP3008Example deviceReadExample

Multiple MCP3008 devices can be attached to the pi. The first one is the device 0:

device := MCP3008Device index: 0.

Each device has 8 channels, indexed from 0 to 7. A simple read to the channel index will provide the analog value, if any input device is connected:

device read: 2.

Note that for now, the recovered value is a string, and must be converted at the application level if it needs to be used as a float value.

About

Small library for the MCP3008 microchip ADC

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp