Chat freely about anything...

User avatar
By szybkipl
#92203 Anyone knows what can I do to fix it?
ets Jan 8 2013,rst cause:4, boot mode:(1,7)
Platform
Hardware: [ESP8266]
Development Env: [Arduino IDE]
Operating System: [Windows 10]
wdt reset


Code: Select all#include <Adafruit_ADS1X15.h>
#include <Wire.h>
// Adafruit_ADS1115 ads;  /* Use this for the 16-bit version */
Adafruit_ADS1015 ads;     /* Use thi for the 12-bit version */
void setup(void)
{
  Serial.begin(115200);
delay(100);
  Wire.begin(5, 4);// GPIO5 - SCL, GPIO4 SDA
  // The ADC input range (or gain) can be changed via the following
  // functions, but be careful never to exceed VDD +0.3V max, or to
  // exceed the upper and lower limits if you adjust the input range!
  // Setting these values incorrectly may destroy your ADC!
  //                                                                ADS1015  ADS1115
  //                                                                -------  -------
  // ads.setGain(GAIN_TWOTHIRDS);  // 2/3x gain +/- 6.144V  1 bit = 3mV      0.1875mV (default)    // activate this if you are using a 5V sensor, this one should  be used with Arduino boards
     ads.setGain(GAIN_ONE);        // 1x gain   +/- 4.096V  1 bit = 2mV      0.125mV               // As the sensor is powered up using 3.3V, this one should be used with 3.3v controller boards
  // ads.setGain(GAIN_TWO);        // 2x gain   +/- 2.048V  1 bit = 1mV      0.0625mV
  // ads.setGain(GAIN_FOUR);       // 4x gain   +/- 1.024V  1 bit = 0.5mV    0.03125mV
  // ads.setGain(GAIN_EIGHT);      // 8x gain   +/- 0.512V  1 bit = 0.25mV   0.015625mV
  // ads.setGain(GAIN_SIXTEEN);    // 16x gain  +/- 0.256V  1 bit = 0.125mV  0.0078125mV
 
//  if (!ads.begin()) {
//    Serial.println("Failed to initialize ADS.");
//    while (1);
//    yield();
//  }
}
void loop(void)
{
 
  int16_t adc0, adc1, adc2, adc3;
  ESP.wdtFeed();
//ESP.wdtDisable();
  adc0 = ads.readADC_SingleEnded(0);
  delay(1000);
 adc1 = ads.readADC_SingleEnded(1);
  delay(10);
//  adc2 = ads.readADC_SingleEnded(2);
//  adc3 = ads.readADC_SingleEnded(3);
  Serial.print("AIN0: "); Serial.println(adc0);
  Serial.print("AIN1: "); Serial.println(adc1);
//  Serial.print("AIN2: "); Serial.println(adc2);
//  Serial.print("AIN3: "); Serial.println(adc3);
 
}
User avatar
By btidey
#92225 I have successfully used that Adafruit library without issues.

Your code includes Wire,h and initialises the i2c but you comment out the ads.begin();

You do not need to include the Wire.h library as the Adafruit one will do that.

Leave out the Wire.begin and use the ads.begin instead before making any other ads calls. This will initialise the i2c with default address and use pins 5 and 4 for scl sda