taking four sample by pass

Este commit está contenido en:
phyto 2019-04-03 18:38:32 +02:00
padre c9e78aa11a
commit 953650c953
Se han modificado 1 ficheros con 16 adiciones y 5 borrados

Ver fichero

@ -4,7 +4,7 @@
/* -------------------------------------------------- */
#define NBVAL 4
#define DELAI 5000
#define DELAI 10000
/* -------------------------------------------------- */
void setup() {
@ -26,15 +26,25 @@ void setup() {
/* -------------------------------------------------- */
/* ================================================== */
short adc_pins[] = { A0, A1, A2, A4 };
#define NB_PASSE 4
/* -------------------------------------------------- */
void updatevalues(short *ptr)
{
int foo;
short foo, pass;
for (foo=0; foo<NBVAL; foo++) {
ptr[foo] = 0;
}
digitalWrite(LED_BUILTIN, HIGH);
for (foo=0; foo<NBVAL; foo++) {
ptr[foo] = analogRead(adc_pins[foo]);
delay(200);
for (pass=0; pass<NB_PASSE; pass++) {
for (foo=0; foo<NBVAL; foo++) {
ptr[foo] += analogRead(adc_pins[foo]);
delay(100);
}
}
for (foo=0; foo<NBVAL; foo++) {
ptr[foo] /= NB_PASSE;
}
digitalWrite(LED_BUILTIN, LOW);
}
/* -------------------------------------------------- */
@ -56,6 +66,7 @@ void update_and_send(void)
updatevalues(values);
sendvalues(values);
}
/* ================================================== */
void loop() {