![]() |
Forum Index : Microcontroller and PC projects : Displaying 2 DS18B20s
Author | Message | ||||
Desw Newbie ![]() Joined: 20/02/2017 Location: AustraliaPosts: 5 |
I cannot work out how to display 2 DS18B20 at the same time.1 is connected to pin16 the other to pin18.How do you give them seperate strings so they can be displayed seperately. The code Im using is DS18B20$=(TEMPR(16)) Thanking you for your help |
||||
jman![]() Guru ![]() Joined: 12/06/2011 Location: New ZealandPosts: 711 |
Temp1$=TEMPR(16) Temp2$=TEMPR(18) Regards Jman |
||||
Desw Newbie ![]() Joined: 20/02/2017 Location: AustraliaPosts: 5 |
I dont know wot Im doing wrong but I keep getting error: Expecting a string with this code Love New Zealand have been there 2 times People very friendly |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6269 |
You have to convert the numerical value returned by TEMPR() to a string Temp1$=STR$(TEMPR(16)) Temp2$=STR$(TEMPR(18)) If you want to display with a fixed number of decimal places, STR$() has options for that. Jim VK7JH MMedit |
||||
skylight Newbie ![]() Joined: 10/01/2016 Location: United KingdomPosts: 23 |
If you wish to leave the result as a number,to perform maths on for conversion from centigrade to Fahrenheit for instance: PRINT "Temperature in Degrees C = " TEMPR(16) PRINT "Temperature in Degrees C = " TEMPR(18) The result x1.8+32 gives the temperature in Fahrenheit. Remember if there is an error in measurement the device will return 1000 so the above formula may give a ridiculous temperature result occasionally, you would need to code to ignore those errors. |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |