1

Topic: Converting numeric variables to RemoteXY "text" strings

Got to admit I find this area of programming a bit of a minefield...

I have some internal numeric variables, both integer and float, that I need to convert into the char arrays used by the RemoteXY interface and GUI.

I know it should be easy enough to do, but getting so much confusing information on the web, it's mashing my brain....

Example of my RemoteXY declarations, which should enable me to convert any of the other numbers, are:-

char totalmins[9]; : This needs to be converted from my internal variable  uint16_t   totalmins;
char cost[6]; :  This to be converted from float  cost; and to display  ###.## format.

If someone could explain how to do this, it will bump me up the learning curve, and I'd be extremely grateful....

TIA

2B, or not 2B, that is the pencil ...

2

Re: Converting numeric variables to RemoteXY "text" strings

Ok, so I'm getting somewhere -

The "totalmins" variable, declared as an "unsigned long" is easily converted to the RemoteXY "char" data-type with...

dtostrf(totalmins, 4, 0, RemoteXY.totalmins);

But why do I have to declare totalmins as an "unsigned long" when the variable will be constrained to 0-999 ?

Are there functions to convert uint16_t or uint8_t to a string ?

Anyone point me to a decent tutorial covering all of this ?

2B, or not 2B, that is the pencil ...

3

Re: Converting numeric variables to RemoteXY "text" strings

We talked about some conversion functions here https://remotexy.com/en/help/indications/text/
We also plan to add the ability to display different types of data to the Text string element

4

Re: Converting numeric variables to RemoteXY "text" strings

remotexy wrote:

We talked about some conversion functions here https://remotexy.com/en/help/indications/text/

Thanks for that link, I was looking in the wrong place for it...

remotexy wrote:

We also plan to add the ability to display different types of data to the Text string element

I believe that a simpler modification would be an option to make a numeric EDIT field non-editable.  Then it becomes a convenient numeric display field. Also the option to remove the border would be good...

2B, or not 2B, that is the pencil ...