Start a new topic

Creating a basic 4x20 within Nextion Logic

This thread will show how to create a basic 4x20 all within the Nextion Logic without the need for an external microprocessor.  As we go through the process of creating this effect, I will deal with a few techniques that may be useful in your projects.


This project was created with Nextion 3.5" Enhanced NX4832K035_011 <Order Here>


image


So lets get started.



So there are very few working parts to put this one together

- 5 variables

- 1 timer

- 1 8x16 font - generating with Consolas is good, I like my cp437

- add a bit of code


1) Start with a blank page, set .bco attribute to 10565

2) Create 4 variables with .id 1 to 4 named ln0, ln1, ln2 and ln3

    - set .sta to String, set .txt_maxl to 20, set .txt to empty

3) Create a timer, default tm0, with .en of 1 .tim as 400

4) Create a variable named chr

    - set .sta to String, set .txt_maxl to 1, set .txt to space char

5) and now for the timer bit of code

    for(sys2=0;sys2<4;sys2++)

    {

      strlen b[sys2+1].txt,sys0

      for(sys1=0;sys1<20;sys1++)

      {

        if(sys1<sys0)

        {

          substr b[sys2+1].txt,chr.txt,sys1,1          

        }else

        {

          chr.txt=" "

        }

        xstr sys1*23+10,sys2*23+10,21,21,0,33808,0,1,1,1,chr.txt

      }

    }


And there she is. Ready for input ...

Change ln0.txt for first line, ln1.txt for second, ln2.txt for third and ln3.txt for fourth


Hope you enjoy, and Happy Coding

Patrick


To gain a more pixilated look, techniques from indev2's 8x8x2 can be added to suit

see indev2's thread here: Nextion MAX7219 8x8 x2 LED emulation


Login or Signup to post a comment