|
Post by curtis2010 on May 25, 2020 9:13:49 GMT -8
Having trouble getting readings from wind direction sensor on WeatherPlus2 board. I've tried a few different ways, but no joy.
Below is my most recent test code. It returns 4095 repeatedly from each channel regardless of rotational position of sensor.
Suggestions?
//
// ADS1015 scan
//
#include <Wire.h>
#include <Adafruit_ADS1015.h>
Adafruit_ADS1015 ads1015;
void setup(void)
{
Serial.begin(9600);
Serial.println("Getting single-ended readings from ads1015...");
ads1015.begin();
}
void loop(void)
{
for (int i=0;i < 4;i++)
{
Serial.print("ads1015:");
Serial.print(i);
Serial.print(" = ");
Serial.println(ads1015.readADC_SingleEnded(i));
}
delay(5000);
}
|
|
|
Post by SDL on May 26, 2020 17:21:15 GMT -8
|
|
|
Post by curtis2010 on May 27, 2020 4:02:06 GMT -8
I ran a scan earlier and saw a device at address 0x49, standard address of the ADS1015 as I understand, so assumed that was it.
The i2C scanner results below:
06:59:54.431 -> I2C Scanner 06:59:54.465 -> Scanning... 06:59:54.465 -> I2C device found at address 0x49 ! 06:59:54.499 -> I2C device found at address 0x77 ! 06:59:54.534 -> done
|
|
|
Post by SDL on May 29, 2020 11:55:58 GMT -8
I don't see where you are setting the address of the ADS1015 to 0x49.
BP
|
|
|
Post by curtis2010 on May 30, 2020 1:27:02 GMT -8
Aha! Right question, wrong address!
For future reference:
The AdaFruit version of this library (Adafruit_ADS1015.h) sets the default address to 0x48. Relevant code snippets below.
#define ADS1015_ADDRESS (0x48) ... Adafruit_ADS1015(uint8_t i2cAddress = ADS1015_ADDRESS);
The SDL version of this library (OWMAdafruit_ADS1015.h) sets the default address to 0x49. I didn't catch that in the I2C trace. Relevant code snippets below.
#define ADS1015_ADDRESS (0x49) ... Adafruit_ADS1015(uint8_t i2cAddress = ADS1015_ADDRESS);
Its working now!
|
|
|
Post by curtis2010 on May 30, 2020 4:02:34 GMT -8
"06:59:54.499 -> I2C device found at address 0x77 !"
Related question, what is at that above address on the WeatherPlus2 board?
|
|
|
Post by SDL on Jun 1, 2020 11:03:32 GMT -8
|
|
|
Post by curtis2010 on Jun 1, 2020 16:32:21 GMT -8
Thanks, all working with both Anemometer and Barometer now.
|
|