ADS1115.ino.ino 1.16 KB
Newer Older
1 2 3
#include <Wire.h>
#include <Adafruit_ADS1015.h>

4 5 6 7
Adafruit_ADS1115 ads0(0x48);
Adafruit_ADS1115 ads1(0x49);
  
int16_t adc0, adc1, adc2, adc3, adc4, adc5, adc6, adc7;
8 9 10
void setup(void) 
{
  Serial.begin(115200);
11
  //Serial.println("Hello!");
12
  
13 14
  //Serial.println("Getting single-ended readings from AIN0..3");
  //Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)");
15
  
16 17
  ads0.begin();
  ads1.begin();
18 19 20 21
}

void loop(void) 
{
22 23
  adc0 = ads0.readADC_SingleEnded(0);
  adc1 = ads0.readADC_SingleEnded(1);
24
  /*adc2 = ads0.readADC_SingleEnded(2);
25 26 27 28
  adc3 = ads0.readADC_SingleEnded(3);
  adc4 = ads1.readADC_SingleEnded(0);
  adc5 = ads1.readADC_SingleEnded(1);
  adc6 = ads1.readADC_SingleEnded(2);
29
  adc7 = ads1.readADC_SingleEnded(3);*/
30 31 32
  Serial.print(adc0);
  Serial.print(" ");
  Serial.print(adc1);
33
  /*Serial.print(" ");
34 35 36
  Serial.print(adc2);
  Serial.print(" ");
  Serial.print(adc3);
37 38 39 40 41 42 43 44 45
  Serial.print(" ");
  Serial.print(adc4);
  Serial.print(" ");
  Serial.print(adc5);
  Serial.print(" ");
  Serial.print(adc6);
  Serial.print(" ");
  Serial.print(adc7);
  Serial.print(" ");
46
  Serial.print(millis());*/
47
  Serial.print("\n");
48 49
  while(millis()%100!=0);
 
50 51
  
}