yozik04 / nextion

Nextion serial client
GNU Lesser General Public License v3.0
25 stars 10 forks source link

example with HMI and python code #12

Closed javed222 closed 3 years ago

javed222 commented 3 years ago

Hello Can you provide a small example using this library in projects with text, buttons etc? Thanks

yozik04 commented 3 years ago

For buttons you will use TOUCH event. That will give you required data to figure out what button was pressed. Text update commands are also in the code example on the repos's main page.

javed222 commented 3 years ago

Thank you very much!

Please, Can you create a TOUCH event on the code example on the repos's main page?

Would be usefully for me!

Thanks for your response

------ Mensaje original ------ De: "Jevgeni Kiski" notifications@github.com Para: "yozik04/nextion" nextion@noreply.github.com CC: "javed222" vazquezeja@yahoo.com; "Author" author@noreply.github.com Enviado: 26/8/2020 17:06:44 Asunto: Re: [yozik04/nextion] example with HMI and python code (#12)

For buttons you will use TOUCH event. That will give you required data to figure out what button was pressed. Text update commands are also in the code example on the repos's main page.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/yozik04/nextion/issues/12#issuecomment-681096215, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG3AUND3QVVZG7LCYVTVOYDSCVTNJANCNFSM4QKZDBXQ.

yozik04 commented 3 years ago

Updated the example

javed222 commented 3 years ago

Thank you yozik04!! Was very useful, you new example!! Only have one question more All is right if the text are in one page, But If have two pages? The client for set text, didn’t had a page_id definition await client.set('field1.txt', val) Please inform me how I must to do Thanks

yozik04 commented 3 years ago

Please look up in nextion protocol. Probably “page-id.component-id” also works

javed222 commented 3 years ago

Thanks

I have two pages: “tablero” and “settings” and this code:

await client.set('tablero.temp.txt', Xtemp) await client.set('tablero.hume.txt', Xtemp) await client.set('tablero.rocio.txt', Xdp)

If run the client, with nextion display on page “tablero” all is right, but if change to page “settings” on nextion, to settings the following error occur: nextion.exceptions.CommandFailed: Variable name invalid for command: tablero.temp.txt="23.0"

I think that the problem is set text on two o more pages

yozik04 commented 3 years ago

Firstly try setting these values in emulator. This will help you find the right path.

javed222 commented 3 years ago

Thank you yozik04!!! Change vscope to global, and all is right now!! Excelent library!!! Regards