DD2-monitor/simulator/rdtemp/rdtemp.ino
2019-01-27 14:59:26 +01:00

49 lines
937 B
C++

/*
* lecture des capteurs de temperature LM35
*/
/* -------------------------------------------------- */
#define NBVAL 4
#define DELAI 10000
int values[NBVAL];
/* -------------------------------------------------- */
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
Serial.print("\n");
delay(2000);
}
/* -------------------------------------------------- */
void updatevalues(void)
{
int foo;
for (foo=0; foo<NBVAL; foo++) {
values[foo] = analogRead(A0);
delay(500);
}
}
/* -------------------------------------------------- */
void sendvalues(void)
{
int foo;
Serial.print("T");
for (foo=0; foo<NBVAL; foo++) {
Serial.print(" ");
Serial.print(values[foo]);
}
Serial.print("\n");
}
/* -------------------------------------------------- */
void loop() {
updatevalues();
sendvalues();
delay(DELAI);
}
/* -------------------------------------------------- */