Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Sensore temperatura frigo
- * Condizionamento: 0 - 5 [V]
- * -50 - 100 [°C]
- */
- #define s_t_frigo A0
- /*
- * Sensore temperatura rosticceria
- * Condizionamento: 0 - 5 [V]
- * -50 - 100 [°C]
- */
- #define s_t_rost A1
- /*
- * Sensore temperatura corsie
- * Condizionamento: 0 - 5 [V]
- * -50 - 100 [°C]
- */
- #define s_t_corsie A2
- /*
- * Sensore umidità corsie
- * Nessun condizionamento
- * 1,5 - 4 [V]
- * 0 - 100 [%]
- */
- #define s_h_corsie A3
- /*
- * Sensore luminosità corsie
- * Condizionamento
- * 0 - 5 [V]
- * 10 - 1000 [lux]
- */
- #define s_l_corsie A4
- /* Pompa di raffreddamento frigo */
- #define a_frigo 2
- /* Resitenza riscaldamento rosticceria */
- #define a_rost 3
- /* Condizionatore corsie*/
- #define a_t_corsie 4
- /* umidificatore*/
- #define a_h_corsie 5
- /* Neon supplementari*/
- #define neon 5
- int t_frigo = 0;
- int t_rost = 0;
- int t_corsie = 0;
- int h_corsie = 0;
- int l_corsie = 0;
- void setup() {
- pinMode(a_frigo,OUTPUT);
- pinMode(a_rost,OUTPUT);
- pinMode(a_t_corsie,OUTPUT);
- pinMode(a_h_corsie,OUTPUT);
- pinMode(neon,OUTPUT);
- }
- void loop() {
- if(millis() % 1800000 == 0){ //Acquisizione dati ogni mezz'ora
- t_frigo = map(analogRead(s_t_frigo), 0, 1023, -50, 100);
- t_rost = map(analogRead(s_t_rost), 0, 1023, -50, 100);
- t_corsie = map(analogRead(s_t_corsie), 0, 1023, -50, 100);
- h_corsie = map(analogRead(s_h_corsie), 307, 819, 0, 100);
- l_corsie = map(analogRead(s_l_corsie), 0, 1023, 10, 1000);
- }
- if(t_frigo > -20) digitalWrite(a_frigo, HIGH);
- else digitalWrite(a_frigo, LOW);
- if(t_rost < 40) digitalWrite(a_rost, HIGH);
- else digitalWrite(a_rost, LOW);
- /* Se tutte le seguenti condizioni sono rispettate, allora -->*/
- if( t_corsie > 23 && t_corsie < 26) digitalWrite(a_t_corsie, LOW);
- else digitalWrite(a_t_corsie, HIGH);
- if( h_corsie > 40) digitalWrite(a_h_corsie, LOW);
- else digitalWrite(a_h_corsie, HIGH);
- if(l_corsie < 300) digitalWrite(neon, HIGH);
- else digitalWrite(neon, LOW);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement