forked from Zaninni/FCC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLed.cpp
More file actions
19 lines (17 loc) · 768 Bytes
/
Led.cpp
File metadata and controls
19 lines (17 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "Led.h"
#include <Wire.h>
// Aggiorna pin di uscita in base agli ingressi
void aggiornaLed() {
if (ingressi[Ptemp].stato) sendLedCommand(LED_ALARM_TMAX);
if (ingressi[Pmin].stato) sendLedCommand(LED_ALARM_MINP);
if (ingressi[Pmax].stato) sendLedCommand(LED_ALARM_MAXP);
if (ingressi[Flow].stato) sendLedCommand(LED_ALARM_NOFLOW);
if (ingressi[Chiller].stato) sendLedCommand(LED_ALARM_CHFAULT);
if (ingressi[Chiller].stato || ingressi[Chiller].stato || ingressi[Chiller].stato || ingressi[Chiller].stato || ingressi[Chiller].stato) sendLedCommand(LED_EMERGENCY_ACTIVE);
}
// Funzione per inviare comando LED allo slave
void sendLedCommand(byte cmd) {
Wire.beginTransmission(SLAVE_ADDR);
Wire.write(cmd);
Wire.endTransmission();
}