/* * Phytotron * lecture des capteurs de temperature LM35 */ /* -------------------------------------------------- */ #define NBVAL 4 #define DELAI 1000 typedef struct { unsigned short magic; char tag[4]; short delai; } Global; Global parametres; /* -------------------------------------------------- */ void setup() { Serial.begin(9600); pinMode(LED_BUILTIN, OUTPUT); Serial.print("\n"); phytocli(); /* XXX */ /* XXX */ /* changing the voltage reference of the ADC * greatly increase the prcision on the limited * range of our temperatures. */ analogReference(INTERNAL1V1); // Pour Arduino Mega2560 Serial.print("\n\n"); delay(1000); Serial.print("M running now\n"); } /* ================================================== */ /* * 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) { short foo, pass; for (foo=0; foo 5) { readlight(); foo = 0; } /* check for CLI request */ if (Serial.available() && 0x55==Serial.read()) { Serial.println("M cli request"); phytocli(); } delay(DELAI); } /* -------------------------------------------------- */