0

ADS1015 ADC freezes/hangs when reading differential in Ardui
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ADS1015 ADC freezes/hangs when reading differential in Ardui

by Amarin98 on Thu Aug 08, 2019 4:31 pm

Hi there,

I was wondering if anyone had any advice or suggestions regarding the code that I am using to read the ADC. The goal is to allow two seconds to check the differential value, and then if it can't then it should just move on in the code. There is an 8 second watch dog timer which restarts everything after that period of time. The problem is that the code keeps restarting, and I think it's because it gets stuck at the "readADC_Differential_0_1()" command (the reasons are based on what the code is returning before it restarts).

Here is the piece of code that I'm referring to (I know it's clunky but please bear with me) :
Code: Select all | TOGGLE FULL SIZE
if (adcOn = true) {
    pH_checker = millis();
    while (millis() - pH_checker < 2000) {
      SensorsValues[0] = phADC.readADC_Differential_0_1();
      break;
    }
    if (millis()- pH_checker > 2000) {
      SensorsValues[0] = -1;
    }
  }


If anyone see something wrong with it that would be great!
Thanks
Attachments
Richard03.41.ino
(71.88 KiB) Downloaded 2 times

Amarin98
 
Posts: 1
Joined: Thu Aug 08, 2019 3:38 pm

Re: ADS1015 ADC freezes/hangs when reading differential in A

by adafruit_support_bill on Thu Aug 08, 2019 4:35 pm

The wire library will sometimes hang if there is a marginal connection or other problem on the i2c bus. If you post some photos showing your soldering and connections we can take a look.

adafruit_support_bill
 
Posts: 74337
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.