Coder Social home page Coder Social logo

ads1256's Introduction

ADS1256 in C++ for the Pi and clones

This is an attempt at a simple C++ library for use with C++ projects. It is focused on the High Precision AD-DA board from Waveshare and provides a simple interface for using that HAT.

DA services will come at some point. This is being used internally by me and may never become easy to use outside of what I need from it. Just beware.

Building

mkdir build
cmake ..
make

Usage

#include <cstdio>
#include <chrono>
#include <thread>
#include <ads1256.h>

int main(int argc, char *argv[])
{
        ADS1256 ads1256;
        double voltages[8];

        ads1256.reset();
        ads1256.configADC(ADS1256_GAIN_1, ADS1256_30000SPS);

        while (ads1256.voltages(voltages, 0, 8) > 0) {
                for (int i = 0; i < 8; i++) {
                        printf("%d %f \r\n", i, voltages[i]);
                }
                printf("\33[8A");
                std::this_thread::sleep_for(std::chrono::milliseconds(1));
        }

        printf("Got a bad return value...\n");
        exit(0);
}

Origin

https://www.waveshare.com/wiki/High-Precision_AD/DA_Board

Most of this code is taken directly from the Waveshare example code provided at the link above. That code is provided with an as-is license and is noted here.

Portions of code were borrowed from

https://github.com/ferbar/raspberry_ads1256_dac8552

License

This code is licensed under the GPLv3. See LICENSE for details

ads1256's People

Contributors

buelowp avatar

Watchers

 avatar

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.