Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By seaurchin
#87345 I decoded the ESP8266 stacktrace I was getting in serial monitor:

Code: Select allDecoding stack results
0x40211de4: operator new[](unsigned int) at ../../../../../dl/gcc-xtensa/libstdc++-v3/libsupc++/new_opv.cc line 33
0x40202219: SensorData::read_sensor_data::analogValues() at /var/folders/43/m1qv9zf53q19sqh6h9kg9pz80000gn/T/arduino_build_623045/sketch/read_sensor_data.cpp line 19
0x402022cc: loop() at /Users/seaurchin/Development/Arduino/wemos/soil_sensor_with_ads/soil_sensor_with_ads.ino line 21
0x40207b24: loop_wrapper() at /Users/seaurchin/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266/core_esp8266_main.cpp line 125


Looks like its pointing to this library read_sensor_data.cpp

Code: Select all#include <Wire.h>
#include <Adafruit_ADS1015.h>
#include "read_sensor_data.h"

Adafruit_ADS1115 ads;

namespace SensorData
{
void read_sensor_data::initializeADC() {
  ads.setGain(GAIN_TWOTHIRDS);
  ads.begin();
}

int* read_sensor_data::analogValues()
  {
 
      int* arr = new int[4];
      int16_t adc0, adc1, adc2, adc3;
      arr[0] = ads.readADC_SingleEnded(0);
      arr[1] = ads.readADC_SingleEnded(1);
      arr[2] = ads.readADC_SingleEnded(2);
      arr[3] = ads.readADC_SingleEnded(3);
      return arr;
  }

}


but I do not understand what is wrong here. :roll: