SerialUI frequently asked questions and troubleshooting.
I can’t connect to SerialUI through the serial port! What’s up?
Use begin(BAUD_RATE) (to set the baud rate and init the serial connection) on the SerialUI object in your setup() routine and make sure it matches the setting in your serial monitor/connection.
SerialUI doesn’t output anything.
Check the question above, first. Then, make sure you are using progmem strings for your menu item keys and help, by using SUI_DeclareString() to declare them.
If that’s not it, turn on debug output (as described in the advance usage compile-time config section) and see what it’s saying. If you can’t see a lot of output about the creation of the objects, something is up prior to SerialUI’s involvement.
How do I get input from a user?
When you’re in a callback and what to get some additional input from the user, it’s a good idea to start by issuing a
mySUI.showEnterDataPrompt();
to show the “…” and prompt the user to enter the required data. What you do after that depends on the type of data you’re expecting. You can use any regular Serial method, like
float some_val = mySUI.parseFloat();
You may also use the SerialUI readBytesToEOL(BUFFER_PTR, MAX_LENGTH) convenience method to read in a string:
char some_string[31]; int numRead = mySUI.readBytesToEOL(some_string, 30);
Know that readBytesToEOL:
- respects all the common line terminator settings (newline, carriage return, CR + NL)
- block until either a line terminator or the maximum number of bytes is received,
The other choice for strings is the regular readBytesUntil. The advantage there is that the timeout is respected (it won’t block forever, in cases where there’s no input), but the downside is that you need to specify the line-terminator character so the user really needs to use the same EOL settings as specified by the code.
How can I change the content of system strings (like prompts and built-in commands)?
String resources used by SerialUI are defined in the appropriate includes/SUIStrings_XX.h file of the library (with XX being replaced by the language in use). Edit that and re-build your program.
How can I change the language used for SerialUI system strings (like help)?
See the information in about SUI_STRINGS_LANGUAGE_XX in the advance usage compile-time config section.
How can I add a new language to the set available to SerialUI?
Create a new includes/SUIStrings_XX.h (replacing XX by the appropriate language code) based on SUIStrings_en.h. Replace all the strings definitions as appropriate. Edit SUIStrings.h and add a section like:
#ifdef SUI_STRINGS_LANGUAGE_XX #include "includes/SUIStrings_XX.h" #endif
Finally, edit SUIConfig.h, undefine SUI_STRINGS_LANGUAGE_EN and
#define SUI_STRINGS_LANGUAGE_XX
in its place. Please contribute this localization file (the includes/SUIStrings_XX.h you created) back to me!
I’m having a problem compiling:
error: initializing argument 2 of bool SUI::Menu::addCommand ...What does this mean?
It means the callback you are attempting to use doesn’t have the correct void (*)() signature (either that callback function takes parameters, returns something other than void or both). Change the function or use a wrapper around it that does have the right signature and use that as your callback.
Can SerialUI work on Arduino DUE?
Yes indeed. However, the platform’s a bit particular in that the progmem strings don’t work the same, so you need to edit includes/SUIConfig.h and define SUI_BUILD_FOR_DUE, as described in the comments of the config file.
All SerialUI pages:
SerialUI Overview
[siblings]
2 thoughts on “SerialUI FAQ”
Bibliothèque non valide trouvée dans C:\Users\michel\Documents\Arduino\libraries\SerialUI-1.13 ???
Faudrait probablement installe le repertoire SerialUI (a l’interieur de SerialUI-1.13) dans ton folder libraries, et non le parent…?