Tutorial on how to write code with Nextion and Arduino

I think a good idea to add in this tutorial the answer that I give in the Quoted question, as a good examle on How to send values and store them on Arduino.

altitudeap:
not sure I have found my answer in the above so I would like to ask the similar question.. I have several pages and I use hotspots to move from page to page. I also want to know what page I am on. In the simulator I see that the output has a structure like this " 65 00 05 01 FF FF FF" What I have been able to discern is that the "05" is the page I have gone to and the "00" is the page I came from.
What serial commands will I use to parse this?

My application is this.

If going from page 0 to page 4. I want to populate a variable x with 540 and a variable y with 1 for direction. (driving a stepper)

if going from page 4 to page 0 I want to populate a variable x with 540 and a variable y with 0 for direction.

it may be a simple case statement of the following.
Serial Step Direction
case String x y
1 65 01 01 01 FF FF FF 790 0
2 65 02 01 01 FF FF FF 540 0
3 65 03 01 01 FF FF FF 1040 0
4 65 04 01 01 FF FF FF 1290 0
5 65 00 02 01 FF FF FF 790 1
6 65 02 02 01 FF FF FF 250 1
7 65 03 02 01 FF FF FF 250 0
8 65 04 02 01 FF FF FF 500 0
9 65 00 04 01 FF FF FF 540 1
10 65 01 04 01 FF FF FF 250 0
11 65 03 04 01 FF FF FF 500 0
12 65 04 04 01 FF FF FF 750 0
13 65 00 05 01 FF FF FF 1040 1
14 65 01 05 01 FF FF FF 250 1
15 65 02 05 01 FF FF FF 500 1
16 65 04 05 01 FF FF FF 250 0
17 65 00 06 01 FF FF FF 1290 1
18 65 01 06 01 FF FF FF 500 1
19 65 02 06 01 FF FF FF 750 1
20 65 03 06 01 FF FF FF 250 1

am I making this more difficult that needed?