GithubHelp home page GithubHelp logo

kashiharaakira / mcp3008pi Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 3 KB

This module is used for get data using MCP3008Pi which convert analog to digital. It uses SPI.

License: MIT License

Python 100.00%

mcp3008pi's Introduction

日本語は下にあります。

MCP3008 with Raspberry Pi

Introduction

This module provide some method using MCP3008. If you want to use this module, you have to enable SPI on your Raspberry Pi and install spi-dev. This README tell you how to do them. I assume that you use Raspbian on your Raspberry Pi.

Usage

Sample Code

#!/usr/bin/env python

from MCP3008Pi import mcp3008

mcp = mcp3008.MCP3008(0,0)

print(mcp.read(0))

mcp.close()

Install Relational Packege

Enable SPI on Your Raspberry Pi

You run the following script on terminal. This process need about 20-30 minitus.

sudo apt-get update
sudo apt-get upgrade
sudo rpi-update

You choose Menu=>Preference=>Raspberry Pi Configuration=>Interface=>SPI and select enable. Then you reboot your raspberry Pi

Install spidev

You run the following script on your terminal.

cd ~
git clone git://github.com/doceme/py-spidev
cd py-spidev
sudo python setup.py install

Confirm spi

python
import spidev

If you not get some error, sucess install spidev.

LICENCE

This module is provided under MIT Licence. The detail of it is on LICENCE file.

Bugs

If you find some bugs of this module, please create new issues on the folloing.

https://github.com/KASHIHARAAkira/MCP3008Pi/issues

ここから日本語

概要

 このモジュールはMCP3008を使ってアナログ・デジタル変換を行った値を取ってくるためのモジュールです。もしも、本モジュールを使う場合はお使いのRaspberry PiのSPIを有効にする必要があります これらの操作に関しても、このREADMEで記載します。  このモジュールはRaspbianでの動作を想定しています。

使用方法

サンプルコード

#!/usr/bin/env python

from MCP3008Pi import mcp3008

mcp = mcp3008.MCP3008(0,0)

print(mcp.read(0))

mcp.close()

関連するパッケージのインストール

Raspberry PiのSPIを有効にする

以下のコマンドをterminalで実行してください。20-30分ほどかかります。

sudo apt-get update
sudo apt-get upgrade
sudo rpi-update

 上のコマンドの処理が終わったらMenu=>Preference=>Raspberry Pi Configuration=>Interface=>SPIを選択し、SPIのところを"enable"に変更します。その後再起動してください。

spidevのインストール

以下のコマンドをterminalで実行してください。

cd ~
git clone git://github.com/doceme/py-spidev
cd py-spidev
sudo python setup.py install

SPIが使用できるか確認

以下のコマンドを実行して、エラーが出なければspidevのinstallに成功しています。

python
import spidev

ライセンス

 このモジュールは、MIT Licenceの下で提供されています。詳しくはLICENCEファイルを御覧ください。

Bugs

もしも本モジュールのバグを見つけられた方は、以下のサイトでissueの発行をお願い致します。

https://github.com/KASHIHARAAkira/MCP3008Pi/issues

mcp3008pi's People

Contributors

akirakashihara avatar kashiharaakira avatar

Watchers

James Cloos avatar  avatar s-dz avatar

mcp3008pi's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.