val = digitalRead(temperature);
This code doesn't work. Not sure what you intended here. You already have the temperature in the variable temperature so just do this...
if (temperature > 27)
val = digitalRead(temperature);
This code doesn't work. Not sure what you intended here. You already have the temperature in the variable temperature so just do this...
if (temperature > 27)