|
2 | 2 | This library will help you control you nextion-display over UART.
|
3 | 3 | ## How to use
|
4 | 4 | First, define an object with the class `nextion(tx_pin, rx_pin, baudrate)`
|
5 |
| -This could look like this now: |
6 |
| -`from nextion import nextion |
7 |
| -display = nextion(13, 12, 9600)` |
| 5 | +This could look like this now:<br> |
| 6 | +`from nextion import nextion<br> |
| 7 | +display = nextion(13, 12, 9600)`<br> |
8 | 8 | Now you can control the device with different commands.
|
| 9 | +## Constants |
| 10 | +- `nextion.WRITE_ONLY` |
| 11 | +- `nextion.READ_AND_WRITE` |
9 | 12 | ## Functions
|
10 | 13 | ### cmd
|
11 |
| -The code to send a |
| 14 | +You can send a command over serial to the device using `display.cmd(command`[ , flags=nextion.READ_AND_WRITE])`<br> |
| 15 | +- `command`: the command to send to the device |
| 16 | +- `flags`: You can insert `nextion.WRITE_ONLY`, when you don't want to read the reply from UART. By default, the function is waiting 100 ms and then, the function returns the reply. |
| 17 | +### sleep |
| 18 | +To enter or exit sleep mode of the nextion device, use the command `display.sleep(state)`<br> |
| 19 | +- `state`: Set the parameter to 1 for enter sleep mode. Set the parameter to 0 for exit sleep mode. |
| 20 | +### page |
| 21 | +To load a page on the nextion device, use the command `display.page(pageid)`<br> |
| 22 | +- `pageid`: ID of the page or name of the page. |
| 23 | +### reset |
| 24 | +You can reset the device using the command `display.reset()` |
| 25 | +### brightness |
| 26 | +To set the display brightness use the command `display.brightness(brightness)`<br> |
| 27 | +- `brightness`: Brightness to set in percent |
0 commit comments