Commit 3c914980 authored by Alisson Claudino's avatar Alisson Claudino

Adição dos códigos para o ADS1115 com leitura dos 4 canais

parent 71a4ce6b
#include <Wire.h>
#include <Adafruit_ADS1015.h>
Adafruit_ADS1115 ads;
int16_t adc0, adc1, adc2, adc3;
float val0;
void setup(void)
{
Serial.begin(115200);
Serial.println("Hello!");
Serial.println("Getting single-ended readings from AIN0..3");
Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)");
ads.setGain(GAIN_TWOTHIRDS); // ganho 1x +/- 4.096V 1 bit = 2mV 0.125mV
ads.begin();
}
void loop(void)
{
adc0 = ads.readADC_SingleEnded(0);
adc1 = ads.readADC_SingleEnded(1);
adc2 = ads.readADC_SingleEnded(2);
adc3 = ads.readADC_SingleEnded(3);;
//Serial.print("ADC0:");
//Serial.print(adc0);
//Serial.print("\n");
//Serial.print("ADC1:");
//Serial.print(adc1);
//Serial.print("\n");
//Serial.print("ADC2:");
while(millis()%20!=0)
{}
Serial.println((float)adc2*5/32767);
//Serial.print("\n");
//Serial.print("ADC3:");
//Serial.print(adc3);
//Serial.print("\n\n");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment