Declare Xfloat object at arduino

Hi there :smiley:

I’ve started programming a 5" enhanced nextion display (connected to a mega 2560) one month ago and so far I’m getting the job done, however I’m finding difficulties to know how to declare a xfloat object in my arduino code (I’m using nextion library to read data).

Does any one have an hint? :nerd_face:

Thanks in advance!!

the library doesn’t have support for it. you’d need to do it using the raw serial protocol

You might duplicate the numeric field class of the library, call it NexxFloat Instead of NexNumber and adapt the code of that copy to fit the slightly different properties and methods.

1 Like

@chrwei @Fjodor Thanks for your answers! :fist_right: :fist_left:
The solution I’ve used was reading a variable which has the same value of the Xfloat on the screen.
Even being a solution that is working perfectly in this case, I’ll try to adapt the library to the Xfloat too.

1 Like

As I know that the xfloat do not have any special control method for change and get value than a number object. So I think it is ok to use a number obeject to get and set value of xfloat. I did not try, if I am wrong just forget about that.