premiere mesure de temperature avec le LM35
This commit is contained in:
47
simulator/rdtemp/rdtemp.ino
Normal file
47
simulator/rdtemp/rdtemp.ino
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* lecture des capteurs de temperature LM35
|
||||
*/
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
#define NBVAL 4
|
||||
#define DELAI 5000
|
||||
|
||||
int values[NBVAL];
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
delay(2000);
|
||||
}
|
||||
/* -------------------------------------------------- */
|
||||
void updatevalues(void)
|
||||
{
|
||||
int foo;
|
||||
for (foo=0; foo<NBVAL; foo++) {
|
||||
values[foo] = analogRead(A0);
|
||||
delay(50);
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------------- */
|
||||
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);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user