Unofficial Nextion/TJC User Forum

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.


This forum is in no way affiliated with NEXTION®, ITEAD STUDIO®, TJC®, or anyone else really. All product names, logos, and brands are property of their respective owners. All company, product, and service names used in this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement from the respective rights holder(s).