I just flip these around and it works

if temperature.0[counter] = 0 then temperature.0[counter] =1
if temperature.0[counter] = 1 then temperature.0[counter] =0