1
0
Fork 0

now reading all 4 tempecaptors

Esse commit está contido em:
tth 2019-02-22 17:16:01 +01:00
commit b6d49bd6f8
1 arquivos alterados com 18 adições e 10 exclusões

Ver arquivo

@ -6,8 +6,6 @@
#define NBVAL 4
#define DELAI 12000
int values[NBVAL];
/* -------------------------------------------------- */
void setup() {
Serial.begin(9600);
@ -21,33 +19,43 @@ void setup() {
analogReference(INTERNAL1V1); // Pour Arduino Mega2560
delay(1000);
Serial.print("M running\n");
}
/* -------------------------------------------------- */
void updatevalues(void)
/* ================================================== */
short adc_pins[] = { A0, A1, A2, A4 };
/* -------------------------------------------------- */
void updatevalues(short *ptr)
{
int foo;
for (foo=0; foo<NBVAL; foo++) {
values[foo] = analogRead(A0);
delay(200);
ptr[foo] = analogRead(adc_pins[foo]);
delay(200);
}
}
/* -------------------------------------------------- */
void sendvalues(void)
void sendvalues(short *ptr)
{
int foo;
Serial.print("T");
for (foo=0; foo<NBVAL; foo++) {
Serial.print(" ");
Serial.print(values[foo]);
Serial.print(ptr[foo]);
}
Serial.print("\n");
}
/* -------------------------------------------------- */
void update_and_send(void)
{
short values[NBVAL];
updatevalues(values);
sendvalues(values);
}
/* ================================================== */
void loop() {
updatevalues();
sendvalues();
update_and_send();
delay(DELAI);
}