Skip to content

Releases: gheinzer/micropython-nextion

v1.1.0

08 Dec 19:42
7f4b48c
Compare
Choose a tag to compare

Version v1.1.0 released. This version was tested with the nextion NX3224T024_011 and the WIFI LoRa 32 V2 SX1276 868MHz. This is the README.md file at this point:

micropython nextion library

This library will help you control you nextion-display over UART.

How to use

First, define an object with the class nextion(tx_pin, rx_pin, baudrate)
This could look like this now:

from nextion import nextion
display = nextion(13, 12, 9600) 

Now you can control the device with different commands.

Constants

  • nextion.WRITE_ONLY
  • nextion.READ_AND_WRITE

Functions

cmd

You can send a command over serial to the device using display.cmd(command[,flags=nextion.READ_AND_WRITE])

  • command: the command to send to the device
  • 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.(optional)

sleep

To enter or exit sleep mode of the nextion device, use the command display.sleep(state)

  • state: Set the parameter to 1 for enter sleep mode. Set the parameter to 0 for exit sleep mode.

page

To load a page on the nextion device, use the command display.page(pageid)

  • pageid: ID of the page or name of the page.

reset

You can reset the device using the command display.reset()

brightness

To set the display brightness use the command display.brightness(brightness)

  • brightness: Brightness to set in percent

Version 1.0.0 released

08 Dec 10:37
Compare
Choose a tag to compare

Basic functions for controlling your nextion display. Tested with the nextion NX3224T024_011. No example files at this point.
This is the README.md-file:

micropython nextion library

This library will help you control you nextion-display over UART.

How to use

First, define an object with the class nextion(tx_pin, rx_pin, baudrate)
This could look like this now:

from nextion import nextion
display = nextion(13, 12, 9600) 

Now you can control the device with different commands.

Constants

  • nextion.WRITE_ONLY
  • nextion.READ_AND_WRITE

Functions

cmd

You can send a command over serial to the device using display.cmd(command[,flags=nextion.READ_AND_WRITE])

  • command: the command to send to the device
  • 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. (optional)

sleep

To enter or exit sleep mode of the nextion device, use the command display.sleep(state)

  • state: Set the parameter to 1 for enter sleep mode. Set the parameter to 0 for exit sleep mode.

page

To load a page on the nextion device, use the command display.page(pageid)

  • pageid: ID of the page or name of the page.

reset

You can reset the device using the command display.reset()

brightness

To set the display brightness use the command display.brightness(brightness)

  • brightness: Brightness to set in percent