mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.4.1 ADS1X15
This commit is contained in:
parent
8e0c4c7aa6
commit
92fe94f226
@ -1,9 +1,9 @@
|
||||
//
|
||||
// FILE: ADS1X15.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.4.0
|
||||
// VERSION: 0.4.1
|
||||
// DATE: 2013-03-24
|
||||
// PUPROSE: Arduino library for ADS1015 and ADS1115
|
||||
// PURPOSE: Arduino library for ADS1015 and ADS1115
|
||||
// URL: https://github.com/RobTillaart/ADS1X15
|
||||
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
//
|
||||
// FILE: ADS1X15.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.4.0
|
||||
// VERSION: 0.4.1
|
||||
// DATE: 2013-03-24
|
||||
// PUPROSE: Arduino library for ADS1015 and ADS1115
|
||||
// PURPOSE: Arduino library for ADS1015 and ADS1115
|
||||
// URL: https://github.com/RobTillaart/ADS1X15
|
||||
//
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
#include "Arduino.h"
|
||||
#include "Wire.h"
|
||||
|
||||
#define ADS1X15_LIB_VERSION (F("0.4.0"))
|
||||
#define ADS1X15_LIB_VERSION (F("0.4.1"))
|
||||
|
||||
// allow compile time default address
|
||||
// address in { 0x48, 0x49, 0x4A, 0x4B }, no test...
|
||||
@ -64,8 +64,8 @@ public:
|
||||
// 0 = slowest
|
||||
// 7 = fastest
|
||||
// 4 = default
|
||||
void setDataRate(uint8_t dataRate = 4); // invalid values are mapped on 4 (default)
|
||||
uint8_t getDataRate(); // actual speed depends on device
|
||||
void setDataRate(uint8_t dataRate = 4); // invalid values are mapped on 4 (default)
|
||||
uint8_t getDataRate(); // actual speed depends on device
|
||||
|
||||
|
||||
int16_t readADC(uint8_t pin = 0);
|
||||
@ -73,7 +73,7 @@ public:
|
||||
|
||||
// used by continuous mode and async mode.
|
||||
[[deprecated("Use getValue() instead")]]
|
||||
int16_t getLastValue() { return getValue(); }; // will be obsolete in the future 0.4.0
|
||||
int16_t getLastValue() { return getValue(); }; // will be obsolete in the future 0.4.0
|
||||
int16_t getValue();
|
||||
|
||||
|
||||
@ -126,8 +126,9 @@ public:
|
||||
// EXPERIMENTAL
|
||||
// see https://github.com/RobTillaart/ADS1X15/issues/22
|
||||
void setWireClock(uint32_t clockSpeed = 100000);
|
||||
// proto - getWireClock returns the value set by setWireClock
|
||||
// not necessary the actual value
|
||||
// prototype
|
||||
// - getWireClock returns the value set by setWireClock
|
||||
// not necessary the actual value
|
||||
uint32_t getWireClock();
|
||||
|
||||
|
||||
|
@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
## [0.4.1] - 2024-01-02
|
||||
- fix some typos
|
||||
- minor edits
|
||||
|
||||
|
||||
## [0.4.0] - 2023-12-06
|
||||
- refactor API, begin()
|
||||
- update readme.md
|
||||
|
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2013-2023 Rob Tillaart
|
||||
Copyright (c) 2013-2024 Rob Tillaart
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -54,7 +54,8 @@ void loop()
|
||||
// we have all values, so process (print) them
|
||||
ADS_print_all();
|
||||
|
||||
delay(1000); // wait a second, comment this line for more samples.
|
||||
// wait a second, comment this line for more samples.
|
||||
delay(1000);
|
||||
ADS_request_all();
|
||||
}
|
||||
|
||||
@ -65,7 +66,8 @@ void ADS_request_all()
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (ADS[i].isConnected()) ADS[i].requestADC(0);
|
||||
delayMicroseconds(200); // get them evenly spaced in time ...
|
||||
// get them evenly spaced in time ...
|
||||
delayMicroseconds(200);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,12 +16,12 @@
|
||||
#include "ADS1X15.h"
|
||||
|
||||
|
||||
// choose your sensor
|
||||
// ADS1013 ADS(0x48);
|
||||
// ADS1014 ADS(0x48);
|
||||
// ADS1015 ADS(0x48);
|
||||
// ADS1113 ADS(0x48);
|
||||
// ADS1114 ADS(0x48);
|
||||
// choose your sensor
|
||||
// ADS1013 ADS(0x48);
|
||||
// ADS1014 ADS(0x48);
|
||||
// ADS1015 ADS(0x48);
|
||||
// ADS1113 ADS(0x48);
|
||||
// ADS1114 ADS(0x48);
|
||||
ADS1115 ADS(0x48, &Wire1);
|
||||
|
||||
|
||||
|
@ -5,10 +5,10 @@
|
||||
// URL: https://github.com/RobTillaart/ADS1X15
|
||||
|
||||
|
||||
// Note all IO with the sensors are guarded by an isConnected()
|
||||
// this is max robust, in non critical application one may either
|
||||
// cache the value or only verify it in setup (least robust).
|
||||
// Less robust may cause the application to hang - watchdog reset ?
|
||||
// Note all IO with the sensors are guarded by an isConnected()
|
||||
// this is max robust, in non critical application one may either
|
||||
// cache the value or only verify it in setup (least robust).
|
||||
// Less robust may cause the application to hang - watchdog reset ?
|
||||
|
||||
|
||||
#include "ADS1X15.h"
|
||||
@ -55,7 +55,8 @@ void loop()
|
||||
// we have all values
|
||||
ADS_print_all();
|
||||
|
||||
delay(1000); // wait a second.
|
||||
// wait a second.
|
||||
delay(1000);
|
||||
ADS_request_all();
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,10 @@
|
||||
// URL: https://github.com/RobTillaart/ADS1X15
|
||||
|
||||
|
||||
// Note all IO with the sensors are guarded by an isConnected()
|
||||
// this is max robust, in non critical application one may either
|
||||
// cache the value or only verify it in setup (least robust).
|
||||
// Less robust may cause the application to hang - watchdog reset ?
|
||||
// Note all IO with the sensors are guarded by an isConnected()
|
||||
// this is max robust, in non critical application one may either
|
||||
// cache the value or only verify it in setup (least robust).
|
||||
// Less robust may cause the application to hang - watchdog reset ?
|
||||
|
||||
|
||||
#include "ADS1X15.h"
|
||||
@ -16,13 +16,13 @@
|
||||
|
||||
ADS1115 ADS0(0x48);
|
||||
ADS1115 ADS1(0x49);
|
||||
//ADS1115 ADS2(0x4A);
|
||||
//ADS1115 ADS3(0x4B);
|
||||
// ADS1115 ADS2(0x4A);
|
||||
// ADS1115 ADS3(0x4B);
|
||||
|
||||
int16_t val0[4] = { 0, 0, 0, 0 };
|
||||
int16_t val1[4] = { 0, 0, 0, 0 };
|
||||
//int16_t val2[4] = { 0, 0, 0, 0 };
|
||||
//int16_t val3[4] = { 0, 0, 0, 0 };
|
||||
// int16_t val2[4] = { 0, 0, 0, 0 };
|
||||
// int16_t val3[4] = { 0, 0, 0, 0 };
|
||||
int idx = 0;
|
||||
|
||||
uint32_t lastTime = 0;
|
||||
|
@ -4,26 +4,25 @@
|
||||
// PURPOSE: read multiple differential continuously
|
||||
// URL: https://github.com/RobTillaart/ADS1X15
|
||||
|
||||
// test
|
||||
// connect 4 potmeters
|
||||
// test
|
||||
// connect 4 potmeters
|
||||
//
|
||||
// GND ---[ x ]------ 5V
|
||||
// |
|
||||
//
|
||||
// measure at x - connect to AIN0..4.
|
||||
// GND ---[ x ]------ 5V
|
||||
// |
|
||||
//
|
||||
// measure at x - connect to AIN0..4.
|
||||
//
|
||||
|
||||
|
||||
#include "ADS1X15.h"
|
||||
|
||||
|
||||
// choose your sensor
|
||||
// ADS1013 ADS(0x48);
|
||||
// ADS1014 ADS(0x48);
|
||||
// ADS1015 ADS(0x48);
|
||||
// ADS1113 ADS(0x48);
|
||||
// ADS1114 ADS(0x48);
|
||||
// choose your sensor
|
||||
// ADS1013 ADS(0x48);
|
||||
// ADS1014 ADS(0x48);
|
||||
// ADS1015 ADS(0x48);
|
||||
// ADS1113 ADS(0x48);
|
||||
// ADS1114 ADS(0x48);
|
||||
ADS1115 ADS(0x48);
|
||||
|
||||
|
||||
@ -45,7 +44,7 @@ void setup()
|
||||
ADS.setGain(0); // 6.144 volt
|
||||
ADS.setDataRate(4); // 0 = slow 4 = medium 7 = fast
|
||||
|
||||
// single shot mode
|
||||
// single shot mode
|
||||
ADS.setMode(1);
|
||||
// start with first pair
|
||||
pair = 01;
|
||||
@ -65,7 +64,7 @@ void loop()
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
// do other stuff here
|
||||
// do other stuff here
|
||||
delay(10);
|
||||
}
|
||||
|
||||
@ -80,7 +79,7 @@ bool handleConversion()
|
||||
val_01 = ADS.getValue();
|
||||
pair = 23;
|
||||
ADS.requestADC_Differential_2_3();
|
||||
return false; // only one done
|
||||
return false; // only one done
|
||||
}
|
||||
|
||||
// last of series to check
|
||||
|
@ -18,12 +18,12 @@
|
||||
#include "ADS1X15.h"
|
||||
|
||||
|
||||
// choose your sensor
|
||||
// ADS1013 ADS(0x48);
|
||||
// ADS1014 ADS(0x48);
|
||||
// ADS1015 ADS(0x48);
|
||||
// ADS1113 ADS(0x48);
|
||||
// ADS1114 ADS(0x48);
|
||||
// choose your sensor
|
||||
// ADS1013 ADS(0x48);
|
||||
// ADS1014 ADS(0x48);
|
||||
// ADS1015 ADS(0x48);
|
||||
// ADS1113 ADS(0x48);
|
||||
// ADS1114 ADS(0x48);
|
||||
ADS1115 ADS(0x48);
|
||||
|
||||
uint16_t count = 0;
|
||||
|
@ -8,8 +8,8 @@
|
||||
//
|
||||
// experimental, not tested extensively
|
||||
|
||||
// test
|
||||
// connect multiple potmeters
|
||||
// test
|
||||
// connect multiple potmeters
|
||||
//
|
||||
// RDY ----------------- pin 2 (for IRQ)
|
||||
//
|
||||
@ -29,12 +29,12 @@
|
||||
#include "ADS1X15.h"
|
||||
|
||||
|
||||
// choose your sensor
|
||||
// ADS1013 ADS(0x48);
|
||||
// ADS1014 ADS(0x48);
|
||||
// ADS1015 ADS(0x48);
|
||||
// ADS1113 ADS(0x48);
|
||||
// ADS1114 ADS(0x48);
|
||||
// choose your sensor
|
||||
// ADS1013 ADS(0x48);
|
||||
// ADS1014 ADS(0x48);
|
||||
// ADS1015 ADS(0x48);
|
||||
// ADS1113 ADS(0x48);
|
||||
// ADS1114 ADS(0x48);
|
||||
ADS1115 ADS(0x48);
|
||||
|
||||
volatile bool RDY = false;
|
||||
@ -119,4 +119,6 @@ void adsReady()
|
||||
RDY = true;
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -5,28 +5,28 @@
|
||||
// interrupt driven to catch all conversions.
|
||||
// URL: https://github.com/RobTillaart/ADS1X15
|
||||
|
||||
// test
|
||||
// connect multiple potmeters
|
||||
// test
|
||||
// connect multiple potmeters
|
||||
//
|
||||
// GND ---[ x ]------ 5V
|
||||
// |
|
||||
// GND ---[ x ]------ 5V
|
||||
// |
|
||||
//
|
||||
// measure at x - connect to AIN0..4.
|
||||
// measure at x - connect to AIN0..4.
|
||||
//
|
||||
// for the test it is good to have AIN3 connected to 5V and AIN4 to GND
|
||||
// so one can see these as references in the output.
|
||||
// for the test it is good to have AIN3 connected to 5V and AIN4 to GND
|
||||
// so one can see these as references in the output.
|
||||
//
|
||||
|
||||
|
||||
#include "ADS1X15.h"
|
||||
|
||||
|
||||
// choose your sensor
|
||||
// ADS1013 ADS(0x48);
|
||||
// ADS1014 ADS(0x48);
|
||||
// ADS1015 ADS(0x48);
|
||||
// ADS1113 ADS(0x48);
|
||||
// ADS1114 ADS(0x48);
|
||||
// choose your sensor
|
||||
// ADS1013 ADS(0x48);
|
||||
// ADS1014 ADS(0x48);
|
||||
// ADS1015 ADS(0x48);
|
||||
// ADS1113 ADS(0x48);
|
||||
// ADS1114 ADS(0x48);
|
||||
ADS1115 ADS(0x48);
|
||||
|
||||
volatile bool RDY = false;
|
||||
|
@ -5,16 +5,16 @@
|
||||
// interrupt driven to catch all conversions.
|
||||
// URL: https://github.com/RobTillaart/ADS1X15
|
||||
|
||||
// test
|
||||
// connect multiple potmeters to 2 ADS1115
|
||||
// test
|
||||
// connect multiple potmeters to 2 ADS1115
|
||||
//
|
||||
// GND ---[ x ]------ 5V
|
||||
// |
|
||||
// GND ---[ x ]------ 5V
|
||||
// |
|
||||
//
|
||||
// measure at x - connect to AIN0..4.
|
||||
// measure at x - connect to AIN0..4.
|
||||
//
|
||||
// for the test it is good to have AIN3 connected to 5V and AIN4 to GND
|
||||
// so one can see these as references in the output.
|
||||
// for the test it is good to have AIN3 connected to 5V and AIN4 to GND
|
||||
// so one can see these as references in the output.
|
||||
//
|
||||
|
||||
|
||||
|
@ -4,27 +4,25 @@
|
||||
// PURPOSE: read multiple differential continuously
|
||||
// URL: https://github.com/RobTillaart/ADS1X15
|
||||
|
||||
// test
|
||||
// connect 4 potmeters
|
||||
// test
|
||||
// connect 4 potmeters
|
||||
//
|
||||
// GND ---[ x ]------ 5V
|
||||
// |
|
||||
//
|
||||
// measure at x - connect to AIN0..4.
|
||||
// GND ---[ x ]------ 5V
|
||||
// |
|
||||
//
|
||||
// measure at x - connect to AIN0..4.
|
||||
//
|
||||
|
||||
|
||||
#include "ADS1X15.h"
|
||||
|
||||
|
||||
// choose your sensor
|
||||
// ADS1013 ADS(0x48);
|
||||
// ADS1014 ADS(0x48);
|
||||
// ADS1015 ADS(0x48);
|
||||
// ADS1113 ADS(0x48);
|
||||
// ADS1114 ADS(0x48);
|
||||
|
||||
// choose your sensor
|
||||
// ADS1013 ADS(0x48);
|
||||
// ADS1014 ADS(0x48);
|
||||
// ADS1015 ADS(0x48);
|
||||
// ADS1113 ADS(0x48);
|
||||
// ADS1114 ADS(0x48);
|
||||
ADS1115 ADS(0x48);
|
||||
|
||||
|
||||
|
@ -4,26 +4,26 @@
|
||||
// PURPOSE: read differential
|
||||
// URL: https://github.com/RobTillaart/ADS1X15
|
||||
|
||||
// test 1
|
||||
// connect 2 potmeters in series
|
||||
// test 1
|
||||
// connect 2 potmeters in series
|
||||
//
|
||||
// GND ---[ x ]------[ y ]---- 5V
|
||||
// | |
|
||||
// GND ---[ x ]------[ y ]---- 5V
|
||||
// | |
|
||||
//
|
||||
// measure at x and y (connect to AIN0 and AIN1).
|
||||
// x should be lower or equal to y
|
||||
// measure at x and y (connect to AIN0 and AIN1).
|
||||
// x should be lower or equal to y
|
||||
|
||||
// test 2
|
||||
// connect 2 potmeters parallel
|
||||
// test 2
|
||||
// connect 2 potmeters parallel
|
||||
//
|
||||
// GND ---[ x ]------ 5V
|
||||
// |
|
||||
// GND ---[ x ]------ 5V
|
||||
// |
|
||||
//
|
||||
// GND ---[ y ]------ 5V
|
||||
// |
|
||||
// GND ---[ y ]------ 5V
|
||||
// |
|
||||
//
|
||||
// measure at x and y (connect to AIN0 and AIN1).
|
||||
// range from -VDD .. +VDD are possible
|
||||
// measure at x and y (connect to AIN0 and AIN1).
|
||||
// range from -VDD .. +VDD are possible
|
||||
|
||||
|
||||
#include <ADS1X15.h>
|
||||
|
@ -5,13 +5,13 @@
|
||||
// interrupt driven to catch all conversions.
|
||||
// URL: https://github.com/RobTillaart/ADS1X15
|
||||
|
||||
// test setup (not tested yet)
|
||||
// - connect 2 ADS1x15 to I2C bus
|
||||
// - connect potmeters to all channels
|
||||
// - code reads both at the same frequency
|
||||
// and calculates differential per pair.
|
||||
// as 2 ADC's go in parallel, two ADS1015 should get
|
||||
// 3000+ differential samples / second.
|
||||
// test setup (not tested yet)
|
||||
// - connect 2 ADS1x15 to I2C bus
|
||||
// - connect potmeters to all channels
|
||||
// - code reads both at the same frequency
|
||||
// and calculates differential per pair.
|
||||
// as 2 ADC's go in parallel, two ADS1015 should get
|
||||
// 3000+ differential samples / second.
|
||||
//
|
||||
|
||||
|
||||
@ -21,9 +21,9 @@
|
||||
ADS1115 ADS_1(0x49);
|
||||
ADS1115 ADS_2(0x48);
|
||||
|
||||
volatile bool RDY_1 = false;
|
||||
volatile bool RDY_2 = false;
|
||||
uint8_t channel = 0;
|
||||
volatile bool RDY_1 = false;
|
||||
volatile bool RDY_2 = false;
|
||||
uint8_t channel = 0;
|
||||
int32_t differential[4] = { 0, 0, 0, 0 };
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ void setup()
|
||||
// SET ALERT RDY PIN (QueConvert mode)
|
||||
// set the MSB of the Hi_thresh register to 1
|
||||
ADS_1.setComparatorThresholdHigh(0x8000);
|
||||
// set the MSB of the Lo_thresh register to 0
|
||||
// set the MSB of the Lo_thresh register to 0
|
||||
ADS_1.setComparatorThresholdLow(0x0000);
|
||||
ADS_1.setComparatorQueConvert(0);
|
||||
|
||||
@ -73,7 +73,7 @@ void setup()
|
||||
attachInterrupt(digitalPinToInterrupt(3), adsReady_2, RISING);
|
||||
|
||||
ADS_2.setMode(0); // continuous mode
|
||||
ADS_2.readADC(channel); // trigger first read
|
||||
ADS_2.readADC(channel); // trigger first read
|
||||
}
|
||||
|
||||
|
||||
@ -109,11 +109,11 @@ bool handleConversion()
|
||||
if (RDY_1 == false) return false;
|
||||
if (RDY_2 == false) return false;
|
||||
|
||||
// read the value of both
|
||||
// read the value of both
|
||||
int16_t a = ADS_1.getValue();
|
||||
int16_t b = ADS_2.getValue();
|
||||
differential[channel] = a - b;
|
||||
// request next channel
|
||||
// request next channel
|
||||
channel++;
|
||||
if (channel >= 4) channel = 0;
|
||||
ADS_1.readADC(channel);
|
||||
|
@ -4,15 +4,15 @@
|
||||
// PURPOSE: read analog input
|
||||
// URL: https://github.com/RobTillaart/ADS1X15
|
||||
|
||||
// test
|
||||
// connect 1 potmeter
|
||||
// test
|
||||
// connect 1 potmeter
|
||||
//
|
||||
// GND ---[ x ]------ 5V
|
||||
// |
|
||||
// GND ---[ x ]------ 5V
|
||||
// |
|
||||
//
|
||||
// measure at x (connect to AIN0).
|
||||
|
||||
// view with Serial Plotter
|
||||
// measure at x (connect to AIN0).
|
||||
//
|
||||
// view with Serial Plotter
|
||||
|
||||
|
||||
#include "ADS1X15.h"
|
||||
@ -38,7 +38,7 @@ void setup()
|
||||
Wire.begin();
|
||||
|
||||
ADS.begin();
|
||||
ADS.setGain(0); // 6.144 volt
|
||||
ADS.setGain(0); // 6.144 volt
|
||||
Serial.println("Voltage");
|
||||
}
|
||||
|
||||
|
@ -18,12 +18,12 @@
|
||||
#include "ADS1X15.h"
|
||||
|
||||
|
||||
// choose your sensor
|
||||
// ADS1013 ADS(0x48);
|
||||
// ADS1014 ADS(0x48);
|
||||
// ADS1015 ADS(0x48);
|
||||
// ADS1113 ADS(0x48);
|
||||
// ADS1114 ADS(0x48);
|
||||
// choose your sensor
|
||||
// ADS1013 ADS(0x48);
|
||||
// ADS1014 ADS(0x48);
|
||||
// ADS1015 ADS(0x48);
|
||||
// ADS1113 ADS(0x48);
|
||||
// ADS1114 ADS(0x48);
|
||||
|
||||
ADS1115 ADS(0x48);
|
||||
|
||||
@ -42,7 +42,7 @@ void setup()
|
||||
Wire.setClock(100000);
|
||||
|
||||
ADS.begin();
|
||||
ADS.setGain(0); // 6.144 volt
|
||||
ADS.setGain(0); // 6.144 volt
|
||||
|
||||
for (int dr = 0; dr < 8; dr++)
|
||||
{
|
||||
|
@ -2,8 +2,7 @@
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: replace internal ADC with external ADC by using pointer to function
|
||||
// URL: https://github.com/RobTillaart/ADS1X15
|
||||
|
||||
|
||||
//
|
||||
// WARNING ONLY TESTED ON AVR
|
||||
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
// measure at x (connect to AIN0).
|
||||
|
||||
|
||||
|
||||
#include "ADS1X15.h"
|
||||
|
||||
ADS1115 ADS(0x48);
|
||||
@ -40,7 +39,7 @@ void loop()
|
||||
int16_t val_2 = ADS.readADC(2);
|
||||
int16_t val_3 = ADS.readADC(3);
|
||||
|
||||
float f = ADS.toVoltage(1); // voltage factor
|
||||
float f = ADS.toVoltage(1); // voltage factor
|
||||
|
||||
Serial.print("\tAnalog0: "); Serial.print(val_0); Serial.print('\t'); Serial.println(val_0 * f, 3);
|
||||
Serial.print("\tAnalog1: "); Serial.print(val_1); Serial.print('\t'); Serial.println(val_1 * f, 3);
|
||||
|
@ -4,13 +4,13 @@
|
||||
// PURPOSE: read analog inputs - asynchronous
|
||||
// URL: https://github.com/RobTillaart/ADS1X15
|
||||
|
||||
// test
|
||||
// connect 1 potmeter per port.
|
||||
// test
|
||||
// connect 1 potmeter per port.
|
||||
//
|
||||
// GND ---[ x ]------ 5V
|
||||
// |
|
||||
// GND ---[ x ]------ 5V
|
||||
// |
|
||||
//
|
||||
// measure at x (connect to AIN0).
|
||||
// measure at x (connect to AIN0).
|
||||
//
|
||||
|
||||
|
||||
|
@ -4,18 +4,18 @@
|
||||
// PURPOSE: read analog inputs - straightforward.
|
||||
// URL: https://github.com/RobTillaart/ADS1X15
|
||||
|
||||
// test
|
||||
// connect 1 potmeter per port.
|
||||
// test
|
||||
// connect 1 potmeter per port.
|
||||
//
|
||||
// GND ---[ x ]------ 5V
|
||||
// |
|
||||
// GND ---[ x ]------ 5V
|
||||
// |
|
||||
//
|
||||
// measure at x (connect to AIN0).
|
||||
// measure at x (connect to AIN0).
|
||||
//
|
||||
|
||||
// EXPERIMENTAL
|
||||
// EXPERIMENTAL
|
||||
//
|
||||
// The RDY pin (or ALERT Pin) is triggered when conversion is ready
|
||||
// The RDY pin (or ALERT Pin) is triggered when conversion is ready
|
||||
//
|
||||
|
||||
|
||||
|
@ -4,19 +4,19 @@
|
||||
// PURPOSE: read analog inputs - straightforward.
|
||||
// URL: https://github.com/RobTillaart/ADS1X15
|
||||
|
||||
// test
|
||||
// connect 1 potmeter per port.
|
||||
// test
|
||||
// connect 1 potmeter per port.
|
||||
//
|
||||
// GND ---[ x ]------ 5V
|
||||
// |
|
||||
// GND ---[ x ]------ 5V
|
||||
// |
|
||||
//
|
||||
// measure at x (connect to AIN0).
|
||||
// measure at x (connect to AIN0).
|
||||
//
|
||||
//
|
||||
// GND ---[LED]---[ALERT_PIN]---[ R ]--- 5V
|
||||
// GND ---[LED]---[ALERT_PIN]---[ R ]--- 5V
|
||||
//
|
||||
// Connect a LED (+ resistor) to ALERT PIN
|
||||
// and see it trigger at configured way by the comparator.
|
||||
// Connect a LED (+ resistor) to ALERT PIN
|
||||
// and see it trigger at configured way by the comparator.
|
||||
//
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/ADS1X15"
|
||||
},
|
||||
"version": "0.4.0",
|
||||
"version": "0.4.1",
|
||||
"license": "MIT",
|
||||
"frameworks": "*",
|
||||
"platforms": "*",
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=ADS1X15
|
||||
version=0.4.0
|
||||
version=0.4.1
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for ADS1015 - I2C 12 bit ADC and ADS1115 I2C 16 bit ADC
|
||||
|
@ -1,7 +1,6 @@
|
||||
//
|
||||
// FILE: unit_test_001.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.0
|
||||
// DATE: 2020-12-03
|
||||
// PURPOSE: unit tests for the SHT31 temperature and humidity sensor
|
||||
// https://github.com/RobTillaart/ADS1X15
|
||||
@ -88,7 +87,7 @@ unittest(test_Voltage)
|
||||
|
||||
assertTrue(ADS.begin());
|
||||
|
||||
// should test all values?
|
||||
// should test all values?
|
||||
ADS.setGain(0);
|
||||
float volts = ADS.getMaxVoltage();
|
||||
float delta = abs(6.144 - volts);
|
||||
|
Loading…
Reference in New Issue
Block a user