Settings

From Bendyroad

Settings are variables that cannot be influenced by program logic.

Settings can be controlled by either keyboard and display, serial or network.

Settings are saved in non-volatile memory (EEPROM). When the power has been turned off, settings are retained.

Keyboard and display

Note: A user manual for the settings screen can be found at User manual settings.

Settings are entered via keyboard and display.

The settings block handles everything: the menu structure, displaying, navigating through the settings pages and individual settings, and entering values.

Add a settings block in the 'Miscellaneous' folder.

Settings

You'll also need blocks (blue arrows) to enable displaying and entering settings:

Next, add one or more "Settings pages"

Note: EEPROM space is quite small, for example 1 kB on an ATMega328P (Arduino Uno) and 4 kB on an ATmega2560 (Arduino Mega2560). Saving strings is therefore not an option.

Settings page

Enter the text to show on the display for this settings page.

Settings page

This will show as:

Settings page on display

Next, add 'Settings item' for each of the settings on the page.

Settings item

You can save the following data types in non-volatile memory:

  • Integers (maximum 32 bit, signed and unsigned)
  • Bits

Settings item

For each setting, the following attributes have to be specified:

  • Initial value (default is 0)
  • Text: this will be displayed on the display when editing the item
  • Type: Integer up to 32 bits, or single bit
  • Unit: For display purposes on the settings page
  • Variable: In which variable the setting is saved

Here is an example of a settings page for two settings items:

Settings items on display