Hi,
I have a problem reading the datasheet of my arduino card (Arduino nano connect RP2040) . Can i use pin A6 and A7 on 12 bits or these only for the Nina W102 (U2) ? How to do ?
Because with these program i read only on 10 bit.
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue1 = analogRead(A6);
int sensorValue2 = analogRead(A7);
// print out the value you read:
double voltage = (sensorValue2 - sensorValue1)*(5/pow(2,12));
Serial.println(sensorValue1);
Serial.println(sensorValue2);
Serial.println(voltage);
double courant = voltage/50.0;
Serial.println(courant);
delay(1); // delay in between reads for stability
}
FYI,
As an aside, I'd think the four Serial.print() calls after the analog reads (presuming you find the right pins) would be more than enough delay (even at much higher baud rates than 9600), so your delay(1) (a millisecond!) is pretty much superfluous.
C
Did you ever find a solution for using A6 as an analog input?
I have this problem as well. All documentation shows A6 is tied to the Nina but can be used simply as an Analog (A6) pin. However, it appears to be pulled up with the internal resistor rendering it useless as an analog pin. Using pinMode(A6,INPUT) doesn't prevent the pullup.