I have an ADS1115 connected to an ESP32 and I would like it to read voltages on the analog ports.
However, any script uploaded to the ESP stops running at the following:
adc.readADC_SingleEnded
No matter whether the ADS1115 is connected to the ESP32 or not and regardless of any other wiring solutions. I also tried different baud rates, different wiring solutions, different USB ports etc. Mostly using a 3.0V cell battery. But it didn't matter, the program just won't run, at least that's how it looks like from the Serial Monitor.
For completeness, here is a sample code ( also tried the example scripts provided in the IDE):
Anyone with ideas please?
cheers
Code: Select all
#include <Wire.h>
#include <Adafruit_ADS1X15.h>
Adafruit_ADS1115 adc;
void setup(void)
{
Serial.begin(115200);
adc.begin();
}
void loop(void)
{
Serial.print("Test line 1 ");
float Voltage = 0.0;
int16_t adc0;
adc0 = adc.readADC_SingleEnded(0);// script stops here
Serial.print("Test line 2 ");// not visible in Serial Monitor
Voltage = (adc0 * 0.1875)/1000;
Serial.print("AN0: ");
Serial.print(adc0);
Serial.print("\tVolts: ");
Serial.println(Voltage,2);
delay(1000);
}
Code: Select all
16:45:01.988 -> ets Jun 8 2016 00:22:57
16:45:01.988 ->
16:45:01.988 -> rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
16:45:01.988 -> flash read err, 1000
16:45:01.988 -> ets_main.c 371
16:45:02.360 -> ets Jun 8 2016 00:22:57
16:45:02.394 ->
16:45:02.394 -> rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
16:45:02.394 -> configsip: 0, SPIWP:0xee
16:45:02.394 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
16:45:02.394 -> mode:DIO, clock div:1
16:45:02.394 -> load:0x3fff0018,len:4
16:45:02.394 -> load:0x3fff001c,len:1216
16:45:02.394 -> ho 0 tail 12 room 4
16:45:02.394 -> load:0x40078000,len:10944
16:45:02.394 -> load:0x40080400,len:6388
16:45:02.394 -> entry 0x400806b4
16:45:02.495 -> Test line 1