c++ codebase to control analog to digital converter in Raspberry Pi
1) Install the build essential package
sudo apt-get install build-essential
cd someDir git clone git://git.drogon.net/wiringPi cd wiringPi && ./build
3) Clone and build this project
cd someDir git clone https://github.com/flavio-fernandes/mcp300x cd mcp300x && make
To use the standalone program, call ./mcp300x or copy it to a location used by your $PATH. The --help should give you all you need to know:
$ ./mcp300x --help Usage: mcp300x [OPTION...] mcp300x, a simple program to read analog values from Mcp3002 or Mcp3008 -2, --mcp3002 Using mcp3002 (default) -8, --mcp3008 Using mcp3008 -c, --clock=gpioPin Clock GPIO pin -d, --delay=milliseconds Delay per sample (0 => none) -i, --digitaln=gpioPin, --mosi=gpioPin Digital In GPIO pin (write command) -o, --digitalout=gpioPin, --miso=gpioPin Digital Out GPIO pin (read values) -r, --repeats[=count] Number of sample reads (0 => infinite) -s, --chipSelect=gpioPin Chip Select GPIO pin
The default gpio pins are hard coded in main.cpp. Feel free to modify them to suit your needs.
In order to use the Mcp300x code, use the files located in the src directory. They should be self contained and easy enough to port over to your project. If not, please submit a pull request and help me make this better.
Last, but certainly not least, let me list a few additional links that were essential in the making of this repo: