Command Parameters
Posted: Sat Dec 26, 2020 3:02 am
Firstly, merry xmas.
I have several text boxs on the UI and I want to pass the values to Arduino using Serial Command.
The issue is that a person can type text within a text box that includes spaces. eg John Citizen
When data is passed to Arduino, it see this as two separate parameters.
For example !SaveProjectData John Citizen Male
. . . . .
void Cmd_SaveProjectData(CommandParameter &Parameters){
_sName = Parameters.NextParameter();
_sSex = Parameters.NextParameter();
. . . . .
In the code above, _sName would be assigned John and _sSex would be assigned Citizen
Referring to the documentation
Working with Command Parameters
Parameters are the optional part of a command which follow the command name. There is 1 space between the command and the first parameter; each parameter is separated by 1 space.
I would value either being able to specify a delimiter eg "|" in the Arduino code or being able to add an escape character wrap around the text from the UI.
If there is a work around, would appreciate some guidance.
Cheers,
Leon
I have several text boxs on the UI and I want to pass the values to Arduino using Serial Command.
The issue is that a person can type text within a text box that includes spaces. eg John Citizen
When data is passed to Arduino, it see this as two separate parameters.
For example !SaveProjectData John Citizen Male
. . . . .
void Cmd_SaveProjectData(CommandParameter &Parameters){
_sName = Parameters.NextParameter();
_sSex = Parameters.NextParameter();
. . . . .
In the code above, _sName would be assigned John and _sSex would be assigned Citizen
Referring to the documentation
Working with Command Parameters
Parameters are the optional part of a command which follow the command name. There is 1 space between the command and the first parameter; each parameter is separated by 1 space.
I would value either being able to specify a delimiter eg "|" in the Arduino code or being able to add an escape character wrap around the text from the UI.
If there is a work around, would appreciate some guidance.
Cheers,
Leon