problem with the OUTPUTS

val = digitalRead(temperature);

val can only be 1 or 0. (HIGH or LOW)