Start a new topic

Help required

 Hello there,


since 2 Days i am trying to realise a specific function.

I don´t know if it is possible and i have tried several ways but nothing works for me..


On page 4 there is the n1 Text field. The value is received from Arduino.

Is it possible to switch to page 6 if the value of n1 is below 0.50?

Otherwise if the value goes over 0.50 switch back to page 4?

In other words it should be an Alarm function.


I don´t use Nextion Library on Arduino.


Thanks in advance

Gerald



HMI

    - Nextion displays use integer math ...

    - therefore no 0.5 as number ...

    - text fields can contain strings like "0.5" ...

    - but this is nolonger a number, it is a string ...

    - therefore no numerical compare <0.5 or such ...

    - even converted to a number, integer is used ...


only way


    - use a temporary number variable on page 4 ...

    - set this variable from Arduino with n1.value*10 after you visually set n1 variable ...

    - now compare on Nextion side temporary variable <5 ...

    - this can be done with a timer or an Arduino triggered click event ...


Hi Gerry
Thanks a lot for your Help! Tried several Hours without success.
On Arduino side i tried this

  NexSerial.print("va0.txt=");
  NexSerial.print(Druckval);         //this variable is pressure * 100
  NexSerial.write(0xff);
  NexSerial.write(0xff);
  NexSerial.write(0xff);

but didn´t work with textfields. I had to use this

  NexSerial.print("t3.txt=");
  NexSerial.write(0x22);
  NexSerial.print(Druckval);
  NexSerial.write(0x22);
  NexSerial.write(0xff);
  NexSerial.write(0xff);
  NexSerial.write(0xff);

This code gives me numbers to my textfield. but if i replace the "t3" wit the "va0", how can i check that the variable is really written? it seems that there is alway 0 in it.
The variable is set as "global" and "number". But i can´t remove the "0" from the val-field.

Thanks for your patience - i am really new to this stuff

Greetings from Austria







 

In the Nextion Editor t3 (Text Component) has Attribute .txt in green color

 (green field - means can change at runtime, not green - readonly)


But in Nextion Editor va0 (Variable Component) has no Attribute .txt


String variables .txt field must be enclosed in double quote char " 0x22

Numeric variables (other than .txt) do not require the double quotes


How to check va0.val has changed?

send get va0.val terminated with the three 0xFF 

this will return the value in 0x71 Nextion Return Data in little endian order.

Thanks a lot - you pointed me in the right direction.

 

Login or Signup to post a comment