This page has no translation to Français yet. The original English version is below. If you’d like to help, great! See how to translate a documentation page in the contribution guide.
Note This is a web-version of a tutorial chapter embedded right into the XOD IDE. To get a better learning experience we recommend to install the desktop IDE or start the browser-based IDE, and you’ll see the same tutorial there.

String Formatting

Screenshot of 210-string-formatting

Here is a program with a text LCD that shows the temperature. We already formatted the thermometers output to get a human readable string on the LCD like “Temp: 14.3C”.

The format-number node transforms the number value to a string with a desired precision.

The concat node concatenates a three parts of the string that we want to see on the display.

To show non-ASCII characters you should specify its hexadecimal character code in the special “\x” notation. Codes differ on various LCD models. For example, if you have an MT-16S2H, the degree character is “\x99”. Check out character tables for your model in its datasheet.

Instructions #

Let’s improve the thermometer to show the degree character on the LCD.

  1. Bind 2 to DIG.
  2. Add one more input pin for the concat node by grabbing the handle.
  3. Bind “\x99” instead of “C”.
  4. Bind “C” to the latest pin of concat.
  5. Upload the program.
Found a typo or mistake? Want to improve the text? Edit this page on GitHub and open a pull request. If you have a complex proposal or you want to discuss the content, feel free to start a new thread on XOD forum.