I’m trying to read in an analog value using the code below, but I get 2047, even when I connect A0 to ground or 3.3. I’ve tried the other pins with similar results. Switching to D0 works and shows a 0 when grounded and 1 when connected to 3.3
Is my spark dead?
int test = A0;
void setup() {
pinMode(test, INPUT);
Serial.begin(9600);
}
void loop() {
Serial.print("A0: ");
Serial.println(analogRead(test));
}
I flashed your code to a core and it worked fine so I do think you have a hardware problem.
Have you measured the 3.3V* line? That is the reference voltage for the ADC (which is inside the ST ARM chip).
If that measures around 3.3V, I think you should email hello@spark.io or enter a support request on the support site and see if they can get you a replacement.