Claire arrive dans le brotch...

This commit is contained in:
phyto
2019-04-27 21:44:48 +02:00
parent a95e2846d4
commit 431e94fb48
3 changed files with 80 additions and 18 deletions

View File

@@ -24,9 +24,21 @@ void setup() {
Serial.print("M running now\n");
}
/* -------------------------------------------------- */
/* ================================================== */
short adc_pins[] = { A0, A1, A2, A4 };
/*
* the light captor is on A4 pin
*/
void readlight(void)
{
short value;
delay(100);
value = analogRead(A4);
Serial.print("L ");
Serial.print(value);
Serial.print('\n');
}
/* ================================================== */
short adc_pins[] = { A0, A1, A2, A3 };
#define NB_PASSE 4
/* -------------------------------------------------- */
void updatevalues(short *ptr)
@@ -57,7 +69,7 @@ void sendvalues(short *ptr)
Serial.print(" ");
Serial.print(ptr[foo]);
}
Serial.print("\n");
Serial.print('\n');
}
/* -------------------------------------------------- */
void update_and_send(void)
@@ -66,12 +78,17 @@ void update_and_send(void)
updatevalues(values);
sendvalues(values);
}
/* ================================================== */
void loop() {
static int foo = 0;
update_and_send();
if (foo++ > 5) {
readlight(); foo = 0;
}
delay(DELAI);
}