Shop OBEX P1 Docs P2 Docs Learn Events
Trying to add temp to JonnyMac's nextion pixel file? — Parallax Forums

Trying to add temp to JonnyMac's nextion pixel file?

I have been trying to add Temp readings from the ds3231.
I watched the videos several times
seems easy when watching the videos.
when trying to do it it does not look that easy.May be I have not got the hang of it.
setup : jonnymac board with ds3231 on SCL=0 and SDA=1,nextion on Rx=8 and Tx=9 pins.
I have ported the program to a 7' intelligent display and it is working well and now I am trying to add temp to it.
When I run the program 1. No temp displayed
2. the clock does not work the semi colon does not blink.
I need help from the nextion experts to show me what I am doing wrong.
Please the errors and corrections so I can get a handle of this very interesting display.

Thank you in anticipation.

P.S :- I attached the the modified jm_controller and the HMI file.

Comments

  • Looks good,

    Don't be afraid to set a default value for your Temp object. You will see it doesn't show up.

    The pco for that object is black and so it is writing your temperature in black on black. Very hard to see.

    Mike

  • like the French war flag, white eagle on white ground?

  • @iseries
    I tried changing the back ground color and issue remains.
    Thanks for the help,
    siri

  • I tried using the simulator and it shoes an error message_"invalid variable"
    I used the varible name from the object.

    i need more help.

    Siri

    Attached is the screenshot of the error.

    1920 x 1080 - 381K
  • msiriwardenamsiriwardena Posts: 301
    edited 2022-02-20 14:27

    I have my issue partly resolved; the issue was that
    I had jm_ fullduplexserial instruction(formatting wrong),
    now the temp is displayed as" 7205 'F" and I am now trying to
    get my formatting wright to display " 72.0'F''.
    I am using a text object not a " Xfloat " object

    Any help is greatly appreciated
    Thanks,

    Siri

  • I assume you changed Temp from xfloat to text.

    So if you set Tempf.val = 7205 and then run the click event for hsSetTemp it should display 72.0F

    To do that you need to change the click event for hsSetTemp:

    //show temperature F
    covx Tempf.val,string.txt,0,0
    Temp.txt=string.txt
    Temp.txt-=2
    Temp.txt+="."
    strlen string.txt,sys0
    sys0-=1
    substr string.txt,string.txt,sys0,1
    Temp.txt+=string.txt
    Temp.txt+="F"
    

    This will convert the value from 7205 to a text value and add the decimal point plus the F at the end

    This conversion could have been done on the spin side.

    Mike

  • msiriwardenamsiriwardena Posts: 301
    edited 2022-02-20 16:56

    Here is the updated pixel controller file and the nextion hmi file.
    Need help to format correctly the controller file.

    Thank you
    siri

  • JonnyMacJonnyMac Posts: 8,926
    edited 2022-02-20 18:35

    If you're going to use a text object instead of xfloat, you need to send your command to the Nextion like this:

      hmi.fstr2(string("temp.txt=\x22%.1f\x22%3c"), tf, $FF) 
    

    When you send text it must be surrounded by quotes. To do this using fstrx() I use \x22 ($22 is a double quote). The %.1f formatter expects your temperature to be in tenths and adds a decimal point to the string.

    Reminder: I spend an enormous amount of time experimenting and you should, too. Since this is a serial message, you can verify the output by sending it to PST. That's what I did.

Sign In or Register to comment.