using 1.1v Vref on the Arduino analog to digital converter for better precision

This commit is contained in:
2019-02-07 10:18:10 +01:00
parent dd4757f56c
commit acd1248fa5
4 changed files with 23 additions and 10 deletions

View File

@@ -4,7 +4,7 @@
/* -------------------------------------------------- */
#define NBVAL 4
#define DELAI 10000
#define DELAI 12000
int values[NBVAL];
@@ -13,7 +13,14 @@ void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
Serial.print("\n");
delay(2000);
/* XXX */
/* changing the voltage reference of the ADC
* greatly increase the prcision on the limited
* range of our temperatures.
*/
analogReference(INTERNAL1V1); // Pour Arduino Mega2560
delay(1000);
}
/* -------------------------------------------------- */
void updatevalues(void)
@@ -21,7 +28,7 @@ void updatevalues(void)
int foo;
for (foo=0; foo<NBVAL; foo++) {
values[foo] = analogRead(A0);
delay(500);
delay(200);
}
}
/* -------------------------------------------------- */