Smitten123
New Member
Hello all, I have written and constructed a circuit using the DS18B20 temperature sensor and connected the sensor to the negative port of C.7. this is the code i have used.
the screen was at first showing "Low temperature 0C", now it wont show anything at all, I am using a plug in power source so its not the batteries that have caused this, any help would be massively appreciated.
Thank you
Code:
init: pause 500
serout B.6,N2400,(254,1)
pause 100
main: readtemp C.7,b1 ;read temperature into b1
if b1 <=10 then ;if the temperature is less than 10 degrees then
serout b.6,N2400,(254,128,"Low Temperature") ;Display Low Temperature on the first line
serout b.6,N2400,(254,192,#b1,"C") ;Display the temperature on the second line
endif
if b1<=10 then ;if the temperature is less than 10 degrees then
high B.3 ;light green LED
else
low B.3 ;turn off green LED
endif
goto main
if b1 >=30 then ;if the temperature is more than 30 degrees then
serout B.6,N2400,(254,128,"High Temperature") ;Display High Temperature on the first line
serout B.6,N2400,(254,192,#b1,"C") ;Display the temperature
endif
if b1 >=30 then ;if the temperature is more than 30 degrees
high B.7 ;turn on the red LED
else
low B.7 ;turn off the red LED
endif
goto main
if b1 >10 and b1 <30 then ;if the temperature is between 11 and 29 degrees then
serout B.6,N2400,(254,128,"Temperature") ;Display the word Temperature on the first line
serout B.6,N2400,(254,192,#b1,"C") ;Display the Temperature on the second line
endif
goto main
Thank you
Last edited by a moderator: