How to connect ADS1115 (ADC) to AudioKit A1S #1932
-
I have a ESP32-A1S AudioKit that is connected to a speaker and uses the SD-card to play music. I am trying to connect a: This: // Initialize the ADS1115 on the same I2C bus.
if (!ads.begin()) {
Serial.println("ADS1115 not found!");
while (1);
} I am not able to come past. Have anyone experienced issues like this and know how I can establish a connection? Is it maybe anything I have misunderstood? Every answer greatly appreciated 🙏🏾 This is my complete Arduino Sketch: #include <Wire.h>
#include <Adafruit_ADS1X15.h>
#include "AudioTools.h"
#include "AudioTools/AudioLibs/AudioBoardStream.h"
#include "AudioTools/AudioLibs/AudioSourceIdxSDFAT.h"
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"
#define BUTTON_PIN 21 // GPIO 21 is connected to the button
Adafruit_ADS1115 ads;
bool isPlaying = false; // Playback status
int lastButtonState = HIGH;
const char *startFilePath = "/";
const char* ext = "mp3";
SdSpiConfig sdcfg(PIN_AUDIO_KIT_SD_CARD_CS, DEDICATED_SPI, SD_SCK_MHZ(10), &SPI);
AudioSourceIdxSDFAT source(startFilePath, ext, sdcfg);
AudioBoardStream kit(AudioKitEs8388V1);
MP3DecoderHelix decoder;
AudioPlayer player(source, kit, decoder);
void setup() {
Serial.begin(115200);
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
// Initialize the default I2C (Wire) with SDA on 18 and SCL on 23.
Wire.begin(18, 23);
// Update the AudioKit CODEC I2C configuration BEFORE calling kit.begin()
auto codecI2COpt = AudioKitEs8388V1.getPins().getI2CPins(PinFunction::CODEC);
auto pin_four = kit.board().getPins().getPin(PinFunction::KEY, 4);
auto pin_five = kit.board().getPins().getPin(PinFunction::KEY, 5);
if (pin_four) pin_four.value().pin_logic = PinLogic::Inactive;
if (pin_five) pin_five.value().pin_logic = PinLogic::Inactive;
if (codecI2COpt) {
auto i2cConfig = codecI2COpt.value();
i2cConfig.p_wire = &Wire; // Force the CODEC to use Wire with 18 and 23
AudioKitEs8388V1.getPins().setI2C(i2cConfig);
}
// Now set up the AudioKit output.
auto cfg = kit.defaultConfig(TX_MODE);
kit.begin(cfg);
// Initialize the ADS1115 on the same I2C bus.
if (!ads.begin()) {
Serial.println("ADS1115 not found!");
while (1);
}
// Set up the audio player.
player.setVolume(0.5);
player.begin();
player.setActive(false);
pinMode(BUTTON_PIN, INPUT_PULLUP);
}
void loop() {
// Some code
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I dont't quite understand what you are trying do do: your wire related logic seems to to be unnecessary because it just implements what the standard AudioDriver functionality is already doing. I havent's used any of those pins but
|
Beta Was this translation helpful? Give feedback.
I dont't quite understand what you are trying do do: your wire related logic seems to to be unnecessary because it just implements what the standard AudioDriver functionality is already doing.
I havent's used any of those pins but