The standard xod/units
library contains a few nodes for converting some popular units. For example, Celsius to Fahrenheit, degrees to radians and so on.
One of these nodes (c-to-f
) is already on the patch and the program shows temperature in Fahrenheit.
Let’s improve the program to see a temperature in Fahrenheit only when the button is pressed.
if-else
below button
.PRS
with COND
.Tc
with F
.c-to-f
with T
.R
with the second pin of concat
.Great! However, we still get a “C” on the LCD, even when the temperature converted to the Fahrenheit. Let’s fix it.
if-else
.PRS
to the new COND
pin."F"
to the T
pin, and "C"
to the F
pin.R
with the latest pin of the concat
node.As was mentioned, the if-else
node can work with numbers and strings depending on the incoming value type. The "F"
and "C"
values you bind have to be put in quotes so that XOD knows what data type do you mean.
See the generic nodes guide for better understanding.