I am finding that my ADC pins are affecting each other’s analog read values when I sampling them consecutively within a software timer.
a = analogRead((int)A1); b = analogRead((int)A0);
While sampling, if I leave A1 floating, I would expect an adc reading value of 300. But if I pull A0 to 3V3, I noticed that my A1 adc reading will go up to something like 1650. Which isnt too good haha.
To my understanding of microcontrollers, there is a separate ADC module within it that gets configured for each read for a pin and sample rate setting… So if I try reading different pins too quickly, I understand that my readings could possibly cross over. I don’t understand the impedance/capacitance factors at play though but I’d think the straight forward solution is either adding a delay between reads or taking a hit on accuracy through modifying the ADC’s internal sampling rate. Is that the case?
However, I dont see any mention of “setADCSampleTime” in the Boron reference guide specifically. Vscode finds the function but it doesnt find any of the parameter constants definitions referenced in the Photon reference guide. So Im a little stuck. Should I directly change the micro’s internal registers? I noticed some dusty forum posts about ADC issues in past deviceOS releases but they seem very specific and possibly solved.
Overall, my mission is to sample these ADC pins consecutively at a fairly high frequency, lets say 1000Hz - 3000HZ. Let me know if my design is the actual problem