Hello guys,
I am struggling to acquire a signal using A8,A9,A10, A11 pins of Arduino Giga R1.
Here's the modified example code I am using:
#include <Arduino_AdvancedAnalog.h>
AdvancedADC adc(A8.get()); // I must use this method to avoid compiler error
// AdvancedADC adc(PC_2C); // this doesn't wok as well I assume AdvancedAnalog relies on pins_arduino.h definitions (where the PureAnalogPins are not defined)
uint64_t last_millis = 0;
void setup() {
Serial.begin(9600);
// Resolution, sample rate, number of samples per channel, queue depth.
if (!adc.begin(AN_RESOLUTION_16, 16000, 32, 128)) {
Serial.println("Failed to start analog acquisition!");
while (1);
}
}
void loop() {
if (adc.available()) {
SampleBuffer buf = adc.read();
// Process the buffer.
if ((millis() - last_millis) > 20) {
Serial.println(buf[0]); // Sample from first channel
Serial.println(buf[1]); // Sample from second channel
last_millis = millis();
}
// Release the buffer to return it to the pool.
buf.release();
}
}
The code compiles, but the serial values are showing values as if the pin is floating (despite I have placed a 1k resistor to 3.3V.
Anyone struggling with the same issue that can suggest me a way out?
Before someone asks: all other pins from A0 to A7 are already used in my final code, so I cannot fallback to one of them!
Thanks a lot for your help!