A library for ADS1015 and ADS1115 from Texas Instruments.

Dependents:   IGGE_Power ADS1015-hello_world ADS1115-hello_world frdm_rtos_Eth ... more

Use like this

#include "mbed.h"
#include "Adafruit_ADS1015.h"
#include "USBSerial.h"

#define SERIAL_BAUD_RATE    9600

I2C i2c(p23, p18);
Adafruit_ADS1015 ads(&i2c);
USBSerial pc; // USB CDC serial port

 
int main() {
    uint16_t reading;
    while (1) {
        reading = ads.readADC_SingleEnded(0); // read channel 0
        pc.printf("reading: %d\r\n", reading); // print reading    
        wait(2); // loop 2 sek
    }
}

Library ported from Arduino at github repository.

Breakout boards from Adafruit: http://learn.adafruit.com/adafruit-4-channel-adc-breakouts/overview

GitHub repository: https://github.com/adafruit/Adafruit_ADS1X15

Committer:
arve0
Date:
Sat Oct 11 08:45:17 2014 +0000
Revision:
5:aa277517f0ad
Parent:
1:659ccb9047ed
ads1115 comments

Who changed what in which revision?

UserRevisionLine numberNew contents of line
arve0 0:8174d9ceeca1 1 Software License Agreement (BSD License)
arve0 0:8174d9ceeca1 2
arve0 1:659ccb9047ed 3 Copyright (c) 2012, Adafruit Industries
arve0 0:8174d9ceeca1 4 All rights reserved.
arve0 0:8174d9ceeca1 5
arve0 0:8174d9ceeca1 6 Redistribution and use in source and binary forms, with or without
arve0 0:8174d9ceeca1 7 modification, are permitted provided that the following conditions are met:
arve0 0:8174d9ceeca1 8 1. Redistributions of source code must retain the above copyright
arve0 0:8174d9ceeca1 9 notice, this list of conditions and the following disclaimer.
arve0 0:8174d9ceeca1 10 2. Redistributions in binary form must reproduce the above copyright
arve0 0:8174d9ceeca1 11 notice, this list of conditions and the following disclaimer in the
arve0 0:8174d9ceeca1 12 documentation and/or other materials provided with the distribution.
arve0 0:8174d9ceeca1 13 3. Neither the name of the copyright holders nor the
arve0 0:8174d9ceeca1 14 names of its contributors may be used to endorse or promote products
arve0 0:8174d9ceeca1 15 derived from this software without specific prior written permission.
arve0 0:8174d9ceeca1 16
arve0 0:8174d9ceeca1 17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
arve0 0:8174d9ceeca1 18 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
arve0 0:8174d9ceeca1 19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
arve0 0:8174d9ceeca1 20 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
arve0 0:8174d9ceeca1 21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
arve0 0:8174d9ceeca1 22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
arve0 0:8174d9ceeca1 23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
arve0 0:8174d9ceeca1 24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
arve0 0:8174d9ceeca1 25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
arve0 0:8174d9ceeca1 26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.