Wish Nextion HMI TFT displays

Toley

Active Member
Licensed User
Hi Cableguy, I have one of them (standard 2,8") they are easy to use and the GUI is constantly updated. They have many versions and size, the latest ones are more performant and have an onboard RTC.

I think it's a cheap an easy way to create a simple LCD user interface.
 

Cableguy

Expert
Licensed User
It does look interesting though one of the advantages of developing with B4R is that you can quite easily use an Android device to implement the interface. An Android device will be simpler to program and will be much more powerful.
Yes, but i'm designing a stand alone "slot car power bench", so, even if I may use the android device as a secondary screen, I need the bench to be completely independent...
 
Last edited:

Cableguy

Expert
Licensed User
Hi Cableguy, I have one of them (standard 2,8") they are easy to use and the GUI is constantly updated. They have many versions and size, the latest ones are more performant and have an onboard RTC.

I think it's a cheap an easy way to create a simple LCD user interface.
Have you got it working under b4r?
 

ta1dr

Member
Licensed User
I have 2.8, 5 and 7 inch I used it with B4J and raspberry pi 2 on my company projects
yep it is very usefull...

draft picture (nextion 7 inch )

od.jpg
 

Cableguy

Expert
Licensed User
the question remains... even if using b4j, how do you hook the touch events to your code???
 

ta1dr

Member
Licensed User
there ara to way
all component has ID number if touch component sent ID or send text variable
also use get command

my lcd new data code

B4X:
Sub lcd_cevap_NewData (buffer() As Byte)
    Dim hmi_txt As String=""
    Dim fn As String=""
    Dim ds As String=""
    Dim by As Int=0
    Dim cnt,i As Int=0
    Dim ne As Byte
    beat.Enabled=False
    hmi_txt=byc.HexFromBytes(buffer)
    cnt=hmi_txt.Length
    ne=buffer(0)
    'wh=buffer(1)
    If ne=0x70 Then  ' string header , for exp textbox or your any va variable text
        For i= 5 To cnt Step 2
            ds=s.Mid(hmi_txt,i,2)
           
            If ds="-1" Then
                file_status=False
                ne=0
                Exit
            End If
            by=Bit.ParseInt(ds, 16)
            If by=Asc("@") Then
               ne=buffer(1)
               Exit
            End If
            by=Bit.ParseInt(ds, 16)
            fn=fn & Chr(by)
        Next
    End If
   
    Select ne
        Case 0
            LogDebug(" dosya hatasi")
        Case 0x65   'command header  
                 kayit_kapat
                 LogDebug("dosya kapandi")
                 Exit
        Case 0x3C '  button component ID
            If file_status=False Then
                hmi_txt=fn & ".xls"
                LogDebug("FN : " & fn)
                file_status=True
                create_excel_file(hmi_txt)
                'hmi_txt_wr("t10.txt",hmi_txt)
                'beat.Enabled=True
                Exit
            End If
        Case 0x25
            If file_status=False Then
                LogDebug("FN : " & fn)
                saat_guncelle(fn)
                Exit
            End If
    End Select
    beat.Enabled=True
End Sub

you can write script all events also download editor and play debug mode
 

Cableguy

Expert
Licensed User
I guess since it uses serial to send/receive the data, it's a matter of correctly parse the data
 

Toley

Active Member
Licensed User
I guess since it uses serial to send/receive the data, it's a matter of correctly parse the data
Yes the touch events are managed by the display itself. You can set an event (with the programming Software) to send a string to the UART. You can also send special commands to the display to trig events and do things on the display. The protocol is a bit complicated but if you look at how it's done in the Arduino library you'll catch it very quickly.

https://www.itead.cc/wiki/Nextion_Instruction_Set
 

Cableguy

Expert
Licensed User
Thanks for the link, it starts to become a bit clearer... I guess a dedicated code module to parse the send/receive data specific to the used gui will make it more friendly...
I'll be buying one next month and go from there...
BTW, how does it behave in normal conditions? like view angle, color distortion, brightness, etc?
 
Top