#define TENSAO
#define LEDBLU
#define LEDGRE
#define LEDYEL
#define LEDRED

int temperature;

void setup() {
  Serial.begin(115200);
  
  pinMode(TENSAO, INPUT);
  pinMode(LEDBLU, OUTPUT);
  pinMode(LEDGRE, OUTPUT);
  pinMode(LEDYEL, OUTPUT);
  pinMode(LEDRED, OUTPUT);
}

void loop() {
  temperature = getTemp();

  Serial.println(temperature);

  if(temperature < 35){ //hipotermia
    hipotermia();
  }else if(temperature < 37.5){ //normal
    normal();
  }else if(temperature < 41){ //febre
    febre();
  }else{ //hipertermia
    hipertermia();
  }

  delay(10); // this speeds up the simulation
}

void hipotermia(){
  digitalWrite(LEDBLU, 1);
  digitalWrite(LEDGRE, 0);
  digitalWrite(LEDYEL, 0);
  digitalWrite(LEDRED, 0);
}

void normal(){
  digitalWrite(LEDBLU, 0);
  digitalWrite(LEDGRE, 1);
  digitalWrite(LEDYEL, 0);
  digitalWrite(LEDRED, 0);
}

void febre(){
  digitalWrite(LEDBLU, 0);
  digitalWrite(LEDGRE, 0);
  digitalWrite(LEDYEL, 1);
  digitalWrite(LEDRED, 0);
}

void hipertermia(){
  digitalWrite(LEDBLU, 0);
  digitalWrite(LEDGRE, 0);
  digitalWrite(LEDYEL, 0);
  digitalWrite(LEDRED, 1);
}