donrecardo
Senior Member
Hi
I have 4 variables, we can call them say, B0, B1, B2, B3
They hold the temperatures given by 4 sensors which I have converted to degrees F.
I need to compare them and output the value and the name of the one who's value is highest so for example, if
B0 = 72
B1 = 51
B2 = 74
B3 = 64
I wish to output to my LCD something like
" Temp = 74 F on B2 "
I tried using
if b0>b1 & b0>b2 & b0>b3 then its_b0
if b1>b0& b1>b2 & b1>b3 then its_b1
if b2>b0 & b2>b1 & b2>b3 then its_b2
if b3>b0 & b3>b1 & b0>b2 then its_b3
Thinking I could then goto sub routines called its_b0 , its_b1 etc
to output the details needed , but if b0>b1 & b0>b2 & b0>b3 then its_b0
syntax errors .
So can someone tell me please, what is the right way to achieve the required result ?
Edit..... I found my own error . I need to put " and " not " & " in the compare lines
Don
I have 4 variables, we can call them say, B0, B1, B2, B3
They hold the temperatures given by 4 sensors which I have converted to degrees F.
I need to compare them and output the value and the name of the one who's value is highest so for example, if
B0 = 72
B1 = 51
B2 = 74
B3 = 64
I wish to output to my LCD something like
" Temp = 74 F on B2 "
I tried using
if b0>b1 & b0>b2 & b0>b3 then its_b0
if b1>b0& b1>b2 & b1>b3 then its_b1
if b2>b0 & b2>b1 & b2>b3 then its_b2
if b3>b0 & b3>b1 & b0>b2 then its_b3
Thinking I could then goto sub routines called its_b0 , its_b1 etc
to output the details needed , but if b0>b1 & b0>b2 & b0>b3 then its_b0
syntax errors .
So can someone tell me please, what is the right way to achieve the required result ?
Edit..... I found my own error . I need to put " and " not " & " in the compare lines
Don
Last edited: