Rushtp #5 - Nextion Intelligent - Photo Frame Algebraic Transition Effects

by Rushtp in Circuits > Electronics

491 Views, 0 Favorites, 0 Comments

Rushtp #5 - Nextion Intelligent - Photo Frame Algebraic Transition Effects

00a - Copy.gif
0a.gif
0b.gif
0c - Copy.jpg
0d - Copy.jpg
0e - Copy.jpg

Table of Contents


Background

In this project I will show how to create eleven transition effects. Eight will mimic the built-in effects I demonstrated in my last project. I have added three additional effects: Fade-in, Bouncing Out and Bunny Hops.

So let’s get started.
In my previous project, Rushtp #4 - Nextion Intelligent - Photo Frame Transition Effects, we enhanced the basic photo frame created in Rushtp #3 - Nextion Intelligent - Photo Frame ExPicture Files From the SD Card with the Nextion Editor built-in transition effects to make the photo changes glide-in from different directions.

  1. 0. Load
  2. 1. top fly into
  3. 2. bottom fly into
  4. 3. left fly into
  5. 4. right fly into
  6. 5. top left fly into
  7. 6. top right fly into
  8. 7. bottom left fly into
  9. 8. bottom right fly into

This had one disadvantage in that to activate the effects the Nextion screen page had to be refreshed at every photo change. I found this a little cumbersome scripting to trigger the effects.

I decided to take a look at how the fly into effects are created. So let’s explore the ExPicture exp0 object x and y co-ordinates

The x and y are attributes that define the top-left corner or origin of an object placed on the screen page.

I will demonstrate how these effects are achieved and give additional examples of some bespoke effects using the object attributes x and y. These co-ordinates can be changed with code during runtime.

Please note: This project can only be created on the Nextion Intelligent Series displays.

I am using the same Nextion Intelligent 7" Touch Screen (NX8048P070-011C) as I have in all my previous projects and will start from where we left off in in my Rushtp #3 - Nextion Intelligent - Photo frame ExPicture files from the SD Card project.

If you have not completed that project you can download the Nextion HMI file and Photo files for this project by following the instructions in Step 1 below.



Acknowledgments & References:

  1. Rod Pierce: Maths is Fun - Linear Equations
  2. A.Forrest: Maths Mutt - Maths Mutt Home - Quadratics
  3. Martijn: The Art of Code - How to Create Cool Bounce Effects Using a Loop
  4. Cheap Controls Tutorials - Nextion Component Names versus IDs



Table of Contents:

Step 1: Nextion Editor - Load The Rushtp #3 Photo Frame Project Files

Step 2: Nextion Editor - Shorthand Conventions I’ll be using...

Step 3: Nextion Editor - Creating A New Font

Step 4: Nextion Editor - The Hidden Zone

Step 5: Nextion Editor - Playing With The Coordinates

Step 6: Nextion Editor - Exploring The Algebra - x & y Linear Equations

Step 7: Nextion Editor – Fade-in Effect

Step 8: Nextion Editor - Bouncing Out

Step 9: Nextion Editor - Bunny Hops

Step 10: Nextion Editor - Automating The Transition

Step 11: Nextion Editor - Tap On The Screen To Toggle The Controls ON/OFF

Step 12: Nextion Editor - Add A Frame Delay Control 1 - 9 Seconds

Step 13: Nextion Editor - Upload To A Nextion Intelligent 7" Touch Screen

Step 14: Summing Up…

Step 15: Download Worked Example


Table of Contents

Supplies

0Sa. IMG_0723.JPG
0Sb. USB Connections.bmp
0Sc. Wiring.bmp


  1. Nextion Intelligent 7" Touch Screen (e.g. NX8048P070-011C)
  2. USB to TTL CP2102 UART Module 5Pin Serial Converter
  3. USB extender cable (3m)
  4. Nextion 7” Display DIY Enclosure (Optional)
  5. 20mm clear heat Shrink tube (Optional)
  6. Nextion Editor (Download)
  7. Nextion Editor Guide
  8. Nextion Instruction set
  9. Adobe Photoshop Elements (NOT Adobe Premiere Elements!)
  10. 32GB Micro SD Card (FAT32 format) Search


The Nextion display is connected using a USB to TTL CP2102 UART Module 5Pin Serial Converter.

The TFT File Output option works fine but the Upload option is easier to use (No fiddling around with the SD card).

If the Upload option does not work have a look at Rushtp #2 - Nextion Editor Serial Upload Not Working - Fixes to get it working.


Table of Contents

Nextion Editor - Load the Rushtp #3 Photo Frame Project Files

1a. Untitled-1.jpg
1b. Untitled-1.jpg
1c. IMG_0778.JPG

I am starting where I left off in my Rushtp #3 - Nextion Intelligent - Photo frame ExPicture files from the SD Card project.

If you have not completed that project you can download the Nextion HMI file and Photo files for this project using the links below.

Rushtp3.txt

Note: This file has been saved as a .txt file because some web browsers will not allow .HMI files to be downloaded! You will have to rename the downloaded Rushtp3.txt file as Rushtp3.HMI before you can open it with the Nextion Editor.

Photo-1.txt, Photo-2.txt, Photo-3.txt, Photo-4.txt, Photo-5.txt, Photo-6.txt, Photo-7.txt, Photo-8.txt, Photo-9.txt, Photo-10.txt, Photo-11.txt

Note: These files have also been saved as a .txt files. Rename them as Photo-1.xi, Photo-2.xi,,,etc. Then copy them into a new "xi Photos" folder in the Nextion Editor Virtual SD Card folder. You will also have to copy the "xi Photos" folder onto the SD Card on the Nextion Intelligent Display before Uploading the Nextion TFT file.

Top Tool Bar

 File, Virtual SD Card Folder

   

	folder		sdcard0
	new		Folder
	folder name	"xi Photos"
	add files	“Photo-1.xi”
			“Photo-2.xi”
			“Photo-3.xi”
			etc...

Open the Rushtp3.HMI file in the Nextion Editor. and SaveAs Rushtp #5 - Nextion Intelligent - Photo Frame Algebraic Transition Effects.HMI.

This file was developed for the Nextion Intelligent Series 7” display screen. To modify it for other size screen, or to include your own images, you will have to follow the whole Rushtp #3 - Nextion Intelligent - Photo Frame ExPicture Files From the SD Card project making adjustments for your screen size, and photos.


Table of Contents

Nextion Editor - Shorthand Conventions I’ll Be Using...

2a. Untitled-1 (2).jpg
2b. Untitled-1.jpg

The Nextion Editor has a number of display areas that contain objects, actions, files or code.

  1. File
  2. Tools
  3. Toolbox
  4. Display
  5. Program.s
  6. Page
  7. Attribute
  8. Event
  9. Pictures
  10. Fonts

So, when referring to placing an object (e.g. Button, b0) I’ll use the following convention
(…this button is just an example and not one used in this project)

b0(Button)

 Toolbox, Button, Attribute

	objname		b0
	vscope 		local
	font   		1
	txt    		"Set value"
	txt_maxl    	9
	x      		250
	y      		125
	w      		80
	h      		30

 Event, Touch Release Event

 n0.val=5


I am not going to explain ever piece of code we are using.
I leave it up you you to work it out. It is not that difficult, but I will explain what we are trying to achieve as we go along.


Table of Contents

Nextion Editor – Creating a New Font

3a. Untitled-2.jpg
3b. Untitled-9.jpg
3c. Untitled-1.jpg
3d. Untitled-1.jpg

Stay in Rushtp #5 - Nextion Intelligent - Photo Frame Algebraic Transition Effects.HMI in the Nextion Editor.

Before we start adding buttons and other objects I want you to create a new font Arial16B. This should be font ID:2.

Top Tool Bar

 Tools, Font Generator, Attribute

 	Height         	16
 	Encoding       	utf-8
 	Font           	Atial
 	Bold           	“ticked”
 	Font Name      	Arial16B


Generator font

 	File Name      	Arial16B.zi


Save

   When Progress: 100%    	OK
   Add the generated font    	Yes


Table of Contents

Nextion Editor - the Hidden Zone

4b.jpg
4c Overlapped photo.jpg
4d Hidden photo.jpg

The Nextion Intelligent 7" (NX8048P070-011C) page size is w800 x h480 pixels with the origin x=0 and y=0 in the top-left corner.

I have set the exPicture exp0 frame to the same size 800x480 to fill the page with the x and y coordinates set to 0, 0.

Let’s look at a bigger picture on an Excel scatter chart.

The chart axes are set to x = -800 to +1600 and y = -480 to +960. I have added a background image to demonstrate the location of the Nextion page.

Now consider what happens when the ExPicture frame has it’s x and y coordinates set outside the page range. As the origin coordinates are moved outside the visible area into the hidden zone the photo gets cropped.

To completely hide the photo we need explore the hidden zone outside the visible area and use the coordinate ranges:

x = -800 to +1600px

y = +480 to -960px


the visible area being:

x = 0 to 800px

y = 0 to 480px


Table of Contents

Nextion Editor - Playing With the Coordinates

5a.gif
5b.jpg
5c.jpg

Assuming you have created Rushtp #5 - Nextion Intelligent - Photo Frame Algebraic Transition Effects.HMI from me previous projects (or downloaded Rushtp3.HMI in Step 1)…

Let’s move The existing browser object out of the way and add two sliders, a button and two numbers

Now resize the fbrowser0 box to w60 x h60 and drag it into the bottom of the display to get it out of the way.

The following additions to the Nextion file will allow us to move the origin of the ExPicture frame along with any of the photos we have selected.

Add these buttons from the Toolbox

n3(Number) - x
Toolbox, Number, Attribute
	objname		n3
	vscope 		local
	font   		0
	val    		0
	len    		3
	format 		Decimal
	x      		115
	y      		48
	w      		40
	h      		30
n4(Number) - y
Toolbox, Number, Attribute
	objname		n4
	vscope 		local
	font   		0
	val    		0
	len    		3
	format 		Decimal
	x      		666
	y      		123
	w      		40
	h      		30


The sliders are programmed to change the x and y coordinates around the extended range:

x = -800 to +1600px(2x the width of the Photo Frame exp0)

y = -480 to +960px  (2x the height of the Photo Frame exp0)


Because the ExPicture frame origin is in it’s top-left corner we only need to move exp0.x from -800 to +800 so I have set the h0 slider max and minimum values to 1600 and 0 respectively. Then I set the slide value h0.val give a mid-point at 800. In the Touch Move Event script I have subtracted 800 from the mid-point value (800) to set exp0.x to 0 and n3.val to 000 (the number box has it’s display to length 3 for this).

Similarly the h1 slider max and Minimum values have been set to 960 and 0 respectively and the h1.val to 480, etc. so that we can move exp0.y from -480 to +480.

Add these sliders from the Toolbox and add the Touch Release Event scripts

h0(Slider) – for x axis
Toolbox, Slider, Attribute
	objname		h0
	vscope 		local
	val    		800
	maxval 		1600
	minval 		0
	x      		182
	y      		54
	w      		500
	h      		25
Event, Touch Move
	n3.val=h0.val-800
	exp0.x=n3.val
h1(Slider) – for y axis
Toolbox, Slider, Attribute
	objname		h1
	vscope 		local
	val    		480
	maxval 		960
	minval 		0
	x      		67
	y      		163
	w      		25
	h      		259
Event, Touch Move
	n4.val=480-h1.val
	exp0.y=n4.val

Add this reset button from the Toolbox and add the Touch Release Event script to reposition the sliders back to x=000 and y=000.

b4(Button) - Reset
Toolbox, Button, Attribute
	objname		b4
	vscope 		local
	font   		2
	txt    		Reset
	txt_maxl	10
	x      		22
	y      		80
	w      		80
	h      		30
Event, Touch Move
	h0.val=800
	n3.val=h0.val
	n3.val-=800
	exp0.x=n3.val
	//
	h1.val=480
	n4.val=h1.val
	n4.val-=480
	exp0.y=n4.val


Run the file in Debug to check everything works.


 So far , So good!

(If things go wrong please recheck the object names and the Event coding).


Table of Contents

Nextion Editor - Exploring the Algebra – X & Y Linear Equations

6a.gif
6b.jpg
6c.jpg
6d.jpg
The Nextion Editor has a number of built-in effects but they require the page to be refreshed before they are activated. I’ll show you how to replicate these effects with x & y coordinate linear equations and add 3 more effect buttons too. All without refreshing the page. (We will program their Touch Release Events as we go along).
  1. 0. Load
  2. 1. top fly into
  3. 2. bottom fly into
  4. 3. left fly into
  5. 4. right fly into
  6. 5. top left fly into
  7. 6. top right fly into
  8. 7. bottom left fly into
  9. 8. bottom right fly into

Effect 1-4 use a simple linier equation to move the photo frame exp0 coordinates in vertical or horizontal lines.
For example "top fly into": x = 0 and y = -480 to 0, step +10. The +10 sets the number of steps along the y axis and hence the speed the photo moves vertically.

The 5-8 diagonal effects are created by incrementing both the x and y coordinates of the photo frame exp0.
For example"top left fly into": x = -800 to 0, Step +10*800/480 and y = -480 to 0 step 10. The *800/480 is ensure the photo frame exp0 moves diagonally in accordance with the screen aspect ratio.

To create the diagonal effects x needs to step +10*800/480 = +16.666 ̇  because of the Nextion screen aspect ratio (480x800). However, x has to be an integer so the script offsets with 16 and continues with step 17 in the loop exp0.x=0 after the coding script has run.


Acknowledgments & References:

  1. Martijn: The Art of Code - How to Create Cool Bounce Effects Using a Loop
  2. Cheap Controls Tutorials - Nextion Component Names versus IDs for a full explanation of IDs


First add a Text box t1 and a Number box n1 from the Toolbox.
The n1(Number) will used to display the effect number corresponding to the list above.

t1(Text)
Toolbox, Text, Attribute
	objname		t1
	vscope 		local
	font   		2
	txt    		"Effect"
	txt_maxl	10
	x      		652
	y      		212
	w      		40
	h      		30
n1(Number)
Toolbox, Number, Attribute
	objname		n1
	vscope 		local
	font   		0
	val    		0
	len    		0
	format 		Decimal
	x      		686
	y      		357
	w      		40
	h      		30


Add this button too and name it bID. It displays the Effect button ID so we can check they are sequenced correctly.

bID(Number)
Toolbox, Nember, Attribute
	objname		bID
	vscope 		local
	font   		2
	bco    		2047
	Pco    		63488
	val    		0
	len    		0
	format 		Decimal
	x      		682
	y      		396
	w      		50
	h      		30


For reasons that I will explain later add the following buttons in sequence, One after the other. This will ensure that the button ID’s are sequential.

We will now create a grid of buttons to trigger each of these effects.

  1. 0. Load
  2. 1. top fly into
  3. 2. bottom fly into
  4. 3. left fly into
  5. 4. right fly into
  6. 5. top left fly into
  7. 6. top right fly into
  8. 7. bottom left fly into
  9. 8. bottom right fly into


(Just like buttons for the built-in effects I demonstrated in: Rushtp #4 - Nextion Intelligent - Photo Frame Transition Effects.HMI)

Add three more buttons for additional effects (We will program them in the later steps).

  1. 9. Fade-in
  2. 10. Bounce out right
  3. 11. Bunny hops


Note: the sequence numbers you create may differ from the ones I obtained. It does not matter as long as the all eleven button ID’s are in sequence.

I’ve also renamed the buttons e0, e1, e2, e3, etc. up to e11.


    Load without any effects Button

e0(Button) load

Formula

x = 0
y = 0
Toolbox, Button, Attribute
	objname		e0
	vscope 		local
	font   		2
	txt    		"0"
	txt_maxl	1
	x      		687
	y      		247
	w      		36
	h      		30
Event, Touch Release Event
   n1.val=0
   bID.val=e0.id
   exp0.aph=127
   exp0.x=0
   n3.val=0
   //
   h0.val=800 //Offset to start the slider at mid-point
   exp0.y=0
   n4.val=0
   h1.val=480 //Offset to start the slider at mid-point


    Vertical or Horizontal Effect Buttons

e1(Button) top fly into

Formula

x = 0
y = -480 to 0, Step +10
Toolbox, Button, Attribute
	objname		e1
	vscope 		local
	font   		2
	txt    		"1"
	txt_maxl	1
	x      		687
	y      		210
	w      		36
	h      		30
Event, Touch Release Event
   n1.val=1
   bID.val=e1.id
   exp0.aph=127
   exp0.x=0
   exp0.y=-480
   while(exp0.y<0)
   {
     exp0.y=exp0.y+10
     n4.val=exp0.y
     h1.val=480-n4.val
     //
     n3.val=exp0.x
     h0.val=800+n3.val
     delay=1
   }

e2(Button) bottom fly into

Formula

x = 0
y = 0 to 480, Step +10
Toolbox, Button, Attribute
	objname		e2
	vscope 		local
	font   		2
	txt    		"2"
	txt_maxl	1
	x      		687
	y      		283
	w      		36
	h      		30
Event, Touch Release Event
   n1.val=2
   bID.val=e2.id
   exp0.aph=127
   exp0.x=0
   exp0.y=480
   while(exp0.y>0)
   {
     exp0.y=exp0.y-10
     n4.val=exp0.y
     h1.val=480-n4.val
     //
     n3.val=exp0.x
     h0.val=800+n3.val
     delay=1
   }

e3(Button) left fly into

Formula

x = -800 to 0, Step +10
y = 0
Toolbox, Button, Attribute
	objname		e3
	vscope 		local
	font   		2
	txt    		"3"
	txt_maxl	1
	x      		645
	y      		247
	w      		36
	h      		30
Event, Touch Release Event
   n1.val=3
   bID.val=e3.id
   exp0.aph=127
   exp0.x=-800
   exp0.y=0
   while(exp0.x<0)
   {
     exp0.x=exp0.x+20//too slow at 10 so set to step 20
     n3.val=exp0.x
     h0.val=800+n3.val
     //
     n4.val=exp0.y
     h1.val=480-n4.val
     delay=1
   }

e4(Button) left fly into

Formula

x = 0 to 800, Step +10
y = 0
Toolbox, Button, Attribute
	objname		e4
	vscope 		local
	font   		2
	txt    		"4"
	txt_maxl	1
	x      		728
	y      		247
	w      		36
	h      		30
Event, Touch Release Event
   n1.val=4
   bID.val=e4.id
   exp0.aph=127
   exp0.x=800
   exp0.y=0
   while(exp0.x>0)
   {
     exp0.x=exp0.x-20//too slow at 10 so set to step 20
     n3.val=exp0.x
     h0.val=800+n3.val
     //
     n4.val=exp0.y
     h1.val=480-n4.val
     delay=1
   }


    Diagonal Effect Buttons

e5(Button) top left fly into

Formula

x = -800 to 0, Step 16.66͘6 ̇
y = -480 to 0 Step 10


Because the x and y scales
are different x needs to
step 10*800/480 = 16.666 ̇


However, x has to be an integer
so the script offsets with 16
and continues with step 17
in the loop exp0.x=0 after
the script has run.


x = -800-16 to 0, Step 17
y = -480 to 0 Step 10
Toolbox, Button, Attribute
	objname		e5
	vscope 		local
	font   		2
	txt    		"5"
	txt_maxl	1
	x      		645
	y      		210
	w      		36
	h      		30
Event, Touch Release Event
   n1.val=5
   bID.val=e5.id
   exp0.aph=127
   exp0.x=-800-16 //16 should actually be 10*800/480=16.666 ̇
   exp0.y=-480
   while(exp0.y<0)
   {
     exp0.y=exp0.y+10
     n4.val=exp0.y
     h1.val=480-n4.val
     //
     exp0.x=exp0.x+17 //17 should actually be 10*800/480=16.666 ̇
     n3.val=exp0.x
     h0.val=800+n3.val
     delay=1
   }

e6(Button) top right fly into

Formula

x = 800 to 0, Step 16.66͘6 ̇
y = -480 to 0 Step 10


Because the x and y scales
are different x needs to
step 10*800/480 = 16.666 ̇


However, x has to be an integer
so the script offsets with 16
and continues with step 17
in the loop exp0.x=0 after
the script has run.


x = 800+16 to 0, Step 17
y = -480 to 0 Step 10
Toolbox, Button, Attribute
	objname		e6
	vscope 		local
	font   		2
	txt    		"6"
	txt_maxl	1
	x      		728
	y      		210
	w      		36
	h      		30
Event, Touch Release Event
   n1.val=6
   bID.val=e6.id
   exp0.aph=127
   exp0.x=800+16 //16 should actually be 10*800/480=16.666 ̇
   exp0.y=-480
   while(exp0.y<0)
   {
     exp0.y=exp0.y+10
     n4.val=exp0.y
     h1.val=480-n4.val
     //
     exp0.x=exp0.x-17 //17 should actually be 10*800/480=16.666 ̇
     n3.val=exp0.x
     h0.val=800+n3.val
     delay=1
   }

e7(Button) bottom left fly into

Formula

x = -800 to 0, Step 16.66͘6 ̇
y = 480 to 0 Step 10


Because the x and y scales
are different x needs to
step 10*800/480 = 16.666 ̇


However, x has to be an integer
so the script offsets with 16
and continues with step 17
in the loop exp0.x=0 after
the script has run.


x = -800+16 to 0, Step 17
y = 480 to 0 Step 10
Toolbox, Button, Attribute
	objname		e7
	vscope 		local
	font   		2
	txt    		"7"
	txt_maxl	1
	x      		645
	y      		283
	w      		36
	h      		30
Event, Touch Release Event
   n1.val=7
   bID.val=e7.id
   exp0.aph=127
   exp0.x=-800-16 //16 should actually be 10*800/480=16.666 ̇
   exp0.y=480
   while(exp0.y>0)
   {
     exp0.y=exp0.y-10
     n4.val=exp0.y
     h1.val=480-n4.val
     //
     exp0.x=exp0.x+17 //17 should actually be 10*800/480=16.666 ̇
     n3.val=exp0.x
     h0.val=800+n3.val
     delay=1
   }

e8(Button) bottom right fly into

Formula

x = 800 to 0, Step 16.66͘6 ̇
y = 480 to 0 Step 10


Because the x and y scales
are different x needs to
step 10*800/480 = 16.666 ̇


However, x has to be an integer
so the script offsets with 16
and continues with step 17
in the loop exp0.x=0 after
the script has run.


x = 800+16 to 0, Step 17
y = 480 to 0 Step 10
Toolbox, Button, Attribute
	objname		e8
	vscope 		local
	font   		2
	txt    		"8"
	txt_maxl	1
	x      		728
	y      		283
	w      		36
	h      		30
Event, Touch Release Event
   n1.val=8
   bID.val=e8.id
   exp0.aph=127
   exp0.x=800+16 //16 should actually be 10*800/480=16.666 ̇
   exp0.y=480
   while(exp0.y>0)
   {
     exp0.y=exp0.y-10
     n4.val=exp0.y
     h1.val=480-n4.val
     //
     exp0.x=exp0.x-17 //17 should actually be 10*800/480=16.666 ̇
     n3.val=exp0.x
     h0.val=800+n3.val
     delay=1
   }


Now add The three more buttons for additional effects (We will program them in the later steps).

e9(Button) Fade-in
Toolbox, Button, Attribute
	objname		e9
	vscope 		local
	font   		2
	txt    		"9"
	ixt_maxl	1
	x      		581
	y      		227
	w      		36
	h      		30


e10(Button) Bouncing out
Toolbox, Button, Attribute
	objname		e10
	vscope 		local
	font   		2
	txt    		"10"
	ixt_maxl	2
	x      		581
	y      		247
	w      		36
	h      		30


e11(Button) Bunny hops
Toolbox, Button, Attribute
	objname		e11
	vscope 		local
	font   		2
	txt    		"11"
	ixt_maxl	1
	x      		581
	y      		283
	w      		36
	h      		30


Right, now run Debug and press the Photos button to load a photo. Then press each of the Effect buttons 1 to 8 to test the transition effects.

 Cool! The Photos run in straight lines.

(If things go wrong please recheck the coding from Step 6).


Table of Contents

Nextion Editor - Fade-in Effect

7a.gif

Nextion editor objects have an Opaqueness attribute aph (0-127) that can be used to change the transparency of an object. In our case we can use it to fade in (or out) any photo displayed in the ExPicture frame exp0 we are using for the photo frame transition.

Add the following code to the Effect e9 button.

    Transparency Effect Button

e9(Button) Fade-in
Toolbox, Button, Attribute
	objname		e9
	vscope 		local
	font   		2
	txt    		"9"
	ixt_maxl	1
	x      		581
	y      		227
	w      		36
	h      		30
Event, Touch Release Event
   n1.val=9
   bID.val=e9.id
   //--------------------------------------------------------
   exp0.x=0
   exp0.y=0
   exp0.aph=1
   while(exp0.aph<127)
   {
     exp0.aph=exp0.aph+2
   delay=1
   }
   //--------------------------------------------------------
   delay=3000   //Hold the picture for 3 seconds


Then run Debug and press the Photos button to load a photo. Then press each of the Effect button 9 to test the Fade-in effect.


Table of Contents

Nextion Editor - Bouncing Out

8a.gif
8b.jpg
8c.jpg

The Excel graph displays a number of y=a+(x-b)2 parabolas (upside down U-shaped curves). The chart starts with a drop from the Nextion page x=0, y=0 coordinates to the screen baseline y=480. Then followed by a number of diminishing bounces out of the bottom-right of the screen.

Acknowledgments & References:
Many thanks to the following tutorials on the internet…
  1. A.Forrest: Maths Mutt - Maths Mutt Home - Quadratics
  2. Martijn: The Art of Code - How to Create Cool Bounce Effects Using a Loop

In Martijn’s YouTube video he demonstrates how create multiple parabolas to make bounces.

In his chart he took note of the x value of the end of the first bounce where y = 0. Then set the start of the next bounce to that value. Doing the same setting each subsequent bounce start at the end of the previous bounce.

In my case I used an Excel scatter chart and adjusted the data values of a to set the height of the bounce. Then I adjusted the value of b until could I visually see in the chart I had moved the start of the next bounce to the end of the previous bounce along the y=480 base line. (I’m an engineer and like to find easy ways to achieve my goals).

If you look at the screen shot of the chart data you can see how the data aligns.

Note: the actual formular I used was y=a+(x-b)2/30. The division by 30 sets the bounce width to a visually pleasing shape for the graph. The bounce was too quick and pointy with lower values.

I used the constraints in a do while loop and an if condition statement to cut off the “Tails” of the bounces so the photos appear to bounce on the bottom of the screen.


Start coding…

Let’s start with a drop from the top-right of the picture frame followed by just one bounce. Copy and paste the following code into the button e10 Touch Release Event.

Bounce Effect Button
e10(Button) Bounce out right








Formula

y=0+(x-0)2>/30
y=0+((x-0)*(x-0))/30
x = 0 to 120


The 0+ sets the height of the top of the bounce x=0.

The -0 sets the bounce Axis of symmetry to x=0.

There is no built-in "squared" function in the Nextion code so tempNr.val * tempNr.val is used.

Division by 30 Sets the bounce width.
Toolbox, Button, Attribute
	objname		e10
	vscope 		local
	font   		2
	txt    		"10"
	ixt_maxl	2
	x      		581
	y      		247
	w      		36
	h      		30
Event, Touch Release Event
   n1.val=10
   bID.val=e10.id
   exp0.aph=127
   //--------------------------------------------------------
   exp0.x=0
   exp0.y=0
   delay=2000 //Hold the picture for 2 second
   //--------------------------------------------------------
   tempNr.val=0
   x.val=exp0.x //Start of x (0)
   y.val=0
   while(y.val>=0&&y.val<480)
   {
     tempNr.val=x.val-0 //Start of bounce
     tempNr.val=tempNr.val*tempNr.val
     y.val=tempNr.val/30 //Sets the bounce width
     if(y.val>480) //Trim off the bounce tails
     {
       y.val=480
     }
     exp0.y=y.val+0 //Photo y position + Top of bounce
     n4.val=exp0.y
     h1.val=480-n4.val
     //
      exp0.x=x.val //Move photo to x position
     n3.val=exp0.x
     h0.val=800+n3.val
     x.val=x.val+10 //Speed of bounce
     delay=1
   }
   //--------------------------------------------------------



Event, Touch Release Event (Cont...)

First Bounce Formula

y=100+(x-235)2/30
y=100+((x-235)*(x-235))/30
x = 120 to 360


The 100+ sets the height of the top of the bounce x=100.

The -235 offsets the bounce Axis of symmetry to x=196
(x= 235/2*800/480 for screen Aspect Ratio).

There is no built-in "squared" function in the Nextion code so tempNr.val * tempNr.val is used.

Division by 30 Sets the bounce width.
   tempNr.val=0
   x.val=exp0.x //Start of x = End of last x (120)
   y.val=0
   while(y.val>=0&&y.val<480)
   {
      tempNr.val=x.val-235 //Start of bounce
     tempNr.val=tempNr.val*tempNr.val
     y.val=tempNr.val/30 //Sets the bounce width
     if(y.val>480) //Trim off the bounce tails
     {
       y.val=480
     }
     exp0.y=y.val+100 //Photo y position + Top of bounce
     n4.val=exp0.y
     h1.val=480-n4.val
     //
     exp0.x=x.val
     n3.val=exp0.x
     h0.val=800+n3.val
     x.val=x.val+10 //Speed of bounce
     delay=1
   }
   //--------------------------------------------------------



Run Debug and check the first bounce works.


Carry on coding the rest of the bounces…

To add the rest of the bounces. Just copy and paste this code below the existing Touch Release Event code.


Event, Touch Release Event (Cont...)

Second Bounce Formula

y=200+(x-440)2/30
y=200+((x-440)*(x-440))/30
x = 360 to 560


The 200+ sets the height of the top of the bounce x=200.

The -440 offsets the bounce Axis of symmetry to x=367
(x= 440/2*800/480 for screen Aspect Ratio).

There is no built-in "squared" function in the Nextion code so tempNr.val * tempNr.val is used.

Division by 30 Sets the bounce width.
   tempNr.val=0
   x.val=exp0.x //Start of x = End of last x (360)
   y.val=0
   while(y.val>=0&&y.val<480)
   {
      tempNr.val=x.val-440 //Start of bounce
     tempNr.val=tempNr.val*tempNr.val
     y.val=tempNr.val/30 //Sets the bounce width
     if(y.val>480) //Trim off the bounce tails
     {
       y.val=480
     }
     exp0.y=y.val+200 //Photo y position + Top of bounce
     n4.val=exp0.y
     h1.val=480-n4.val
     //
     exp0.x=x.val
     n3.val=exp0.x
     h0.val=800+n3.val
     x.val=x.val+10 //Speed of bounce
     delay=1
   }
   //--------------------------------------------------------



Event, Touch Release Event (Cont...)

Third Bounce Formula

y=300+(x-615)2/30
y=300+((x-615)*(x-615))/30
x = 560 to 740


The 300+ sets the height of the top of the bounce x=300.

The -615 offsets the bounce Axis of symmetry to x=513
(x= 615/2*800/480 for screen Aspect Ratio).

There is no built-in "squared" function in the Nextion code so tempNr.val * tempNr.val is used.

Division by 30 Sets the bounce width.
   tempNr.val=0
   x.val=exp0.x //Start of x = End of last x (560)
   y.val=0
   while(y.val>=0&&y.val<480)
   {
      tempNr.val=x.val-615 //Start of bounce
     tempNr.val=tempNr.val*tempNr.val
     y.val=tempNr.val/30 //Sets the bounce width
     if(y.val>480) //Trim off the bounce tails
     {
       y.val=480
     }
     exp0.y=y.val+300 //Photo y position + Top of bounce
     n4.val=exp0.y
     h1.val=480-n4.val
     //
     exp0.x=x.val
     n3.val=exp0.x
     h0.val=800+n3.val
     x.val=x.val+10 //Speed of bounce
     delay=1
   }
   //--------------------------------------------------------



Event, Touch Release Event (Cont...)

Fourth Bounce Formula

y=370+(x-760)2/30
y=370+((x-760)*(x-760))/30
x = 740 to 800


The 370+ sets the height of the top of the bounce x=370.

The -760 offsets the bounce Axis of symmetry to x=633
(x= 760/2*800/480 for screen Aspect Ratio).

There is no built-in "squared" function in the Nextion code so tempNr.val * tempNr.val is used.

Division by 30 Sets the bounce width.
   tempNr.val=0
   x.val=exp0.x //Start of x = End of last x (740)
   y.val=0
   while(y.val>=0&&y.val<480)
   {
      tempNr.val=x.val-760 //Start of bounce
     tempNr.val=tempNr.val*tempNr.val
     y.val=tempNr.val/30 //Sets the bounce width
     if(y.val>480) //Trim off the bounce tails
     {
       y.val=480
     }
     exp0.y=y.val+370 //Photo y position + Top of bounce
     n4.val=exp0.y
     h1.val=480-n4.val
     //
     exp0.x=x.val
     n3.val=exp0.x
     h0.val=800+n3.val
     x.val=x.val+10 //Speed of bounce
     delay=1
   }
   //--------------------------------------------------------



Event, Touch Release Event (Cont...)

Move to bottom-right Formula

exp0.x=800
exp0.y=480


Photo out of the screen.
//Move photo to bottom-right (Out of view)
   exp0.x=800
   exp0.y=480
   n4.val=exp0.y
   h1.val=480-n4.val
    //
   x.val=exp0.x
   n3.val=exp0.x
   h0.val=800+n3.val


Right, now run Debug and press the Photos button to load a photo. Then press Effect button 10 to test the full Bounce out transition effect.

 Great! That got them bouncing.

(If things go wrong please recheck the coding from Step 8).


Table of Contents

Nextion Editor - Bunny Hops

9a.gif
9b.jpg
9c.jpg

Here my aim was to create another bounce effect with an offset to make the photo frame bounce into the screen. In practice I found the coding more difficult than I intended.

However the resulting Bunny Hop effect works for me. So I kept it.

I used the constraints in a do while loop and an if condition statement to cut off the “Tails” of the bounces so the photos appear to bounce on the bottom of the screen. In actual fact the bounces start below the bottom of the screen.

Acknowledgments & References:
Many thanks again to the following tutorials on the internet…
  1. A.Forrest: Maths Mutt - Maths Mutt Home - Quadratics
  2. Martijn: The Art of Code - How to Create Cool Bounce Effects Using a Loop


Get coding…

Let’s start with a drop from the top-right of the picture frame followed by just one bounce. Copy and paste the following code into the button e10 Touch Release Event.

Hop Effect Button
e11(Button) Bunny hops








First Hop Formula

y=-80+(x-850)2/30
y=-80+((x-850)*(x-850))/30
x = 0 to 80
exp0.x = -800 to -720


The start of bounce the -850 has been offset by -800 to get the bounce to start on the left of the screen, x.val=+50 where exp0.x=0.

The picture frame top of bounce (Axis of symmetry) exp0.y=-80 because I have offset y.val=400 by -480 to get the photo to bounce on the bottom of the screen.
Toolbox, Button, Attribute
	objname		e11
	vscope 		local
	font   		2
	txt    		"11"
	ixt_maxl	2
	x      		581
	y      		283
	w      		36
	h      		30
Event, Touch Release Event
   n1.val=11
   bID.val=e11.id
   exp0.aph=127
   //--------------------------------------------------------
   tempNr.val=0
   x.val=0 //Start of x (0)
   y.val=0
   while(y.val>=-480&&y.val<=480)
   {
     tempNr.val=x.val+850-800 //Start of bounce (+50)
     tempNr.val=tempNr.val*tempNr.val
     y.val=tempNr.val/30 //Sets the bounce width
     if(y.val>=480) //Trim off the bounce tails
     {
       exp0.y=480
     }
     exp0.y=y.val-80 //Top of bounce (400-480=-80)
     n4.val=exp0.y
     h1.val=480-n4.val
     //
     exp0.x=x.val-800
     n3.val=exp0.x
     h0.val=800+n3.val
     x.val=x.val+10 //Speed of bounce
     delay=10 //Slow it down a bit
   }
   //--------------------------------------------------------


Run Debug and check the first hop works.


Carry on coding the rest of the hops…

To add the rest of the hops just copy and paste this code below the existing Touch Release Event code.

Event, Touch Release Event (Cont...)

Second Hop Formula

y=-180+(x-720)2/30
y=-180+((x-720)*(x-720))/30
x = +80 to +220
exp0.x = -720 to -600


The start of bounce the +720 has been offset by -800 to get the bounce to start on the left of the screen, x.val=-80 where exp0.x=80.

The picture frame top of bounce (Axis of symmetry) exp0.y=-180 because I have offset y.val=300 by -480 to get the photo to bounce on the bottom of the screen.
   tempNr.val=0
   //x.val=80 //Start of x = End of last x (80)
   y.val=0
   while(y.val>=-480&&y.val<=480)
   {
     tempNr.val=x.val+720-800 //Start of bounce (-80)
     tempNr.val=tempNr.val*tempNr.val
     y.val=tempNr.val/30 //Sets the bounce width
     if(y.val>=480) //Trim off the bounce tails
     {
       exp0.y=480
     }
     exp0.y=y.val-180 //Top of bounce (300-480=-180)
     n4.val=exp0.y
     h1.val=480-n4.val
     //
     exp0.x=x.val-800
     n3.val=exp0.x
     h0.val=800+n3.val
     x.val=x.val+10 //Speed of bounce
     delay=10 //Slow it down a bit
   }
   //--------------------------------------------------------

Event, Touch Release Event (Cont...)

Third Hop Formula

y=-300+(x-550)2/30
y=-300+((x-550)*(x-550))/30
x = +220 to +390
exp0.x = -580 to -430


The start of bounce the +550 has been offset by -800 to get the bounce to start on the left of the screen, x.val=-250 where exp0.x=220.

The picture frame top of bounce (Axis of symmetry) exp0.y=-300 because I have offset y.val=180 by -480 to get the photo to bounce on the bottom of the screen.
   tempNr.val=0
   //x.val=220 //Start of x = End of last x (220)
   y.val=0
   while(y.val>=-480&&y.val<=480)
   {
     tempNr.val=x.val+550-800 //Start of bounce (-250)
     tempNr.val=tempNr.val*tempNr.val
     y.val=tempNr.val/30 //Sets the bounce width
     if(y.val>=480) //Trim off the bounce tails
     {
       exp0.y=480
     }
     exp0.y=y.val-300 //Top of bounce (180-480=-300)
     n4.val=exp0.y
     h1.val=480-n4.val
     //
     exp0.x=x.val-800
     n3.val=exp0.x
     h0.val=800+n3.val
     x.val=x.val+10 //Speed of bounce
     delay=10 //Slow it down a bit
   }
   //--------------------------------------------------------

Event, Touch Release Event (Cont...)

Fourth Hop Formula

y=-400+(x-350)2/30
y=-400+((x-350)*(x-350))/30
x = +390 to +590
exp0.x = -410 to -210


The start of bounce the +350 has been offset by -800 to get the bounce to start on the left of the screen, x.val=-450 where exp0.x=390.

The picture frame top of bounce (Axis of symmetry) exp0.y=-400 because I have offset y.val=80 by -480 to get the photo to bounce on the bottom of the screen.
   tempNr.val=0
   //x.val=390 //Start of x = End of last x (390)
   y.val=0
   while(y.val>=-480&&y.val<=480)
   {
     tempNr.val=x.val+350-800 //Start of bounce (-450)
     tempNr.val=tempNr.val*tempNr.val
     y.val=tempNr.val/30 //Sets the bounce width
     if(y.val>=480) //Trim off the bounce tails
     {
       exp0.y=480
     }
     exp0.y=y.val-400 //Top of bounce (80-480=-400)
     n4.val=exp0.y
     h1.val=480-n4.val
     //
     exp0.x=x.val-800
     n3.val=exp0.x
     h0.val=800+n3.val
     x.val=x.val+10 //Speed of bounce
     delay=10 //Slow it down a bit
   }
   //--------------------------------------------------------

Event, Touch Release Event (Cont...)

Fifth Hop Formula

y=-480+(x-120)2/30
y=-480+((x-120)*(x-120))/30
x = +590 to +800
exp0.x = -210 to 0


The start of bounce the +120 has been offset by -800 to get the bounce to start on the left of the screen, x.val=-680 where exp0.x=590.

The picture frame top of bounce (Axis of symmetry) exp0.y=-480 because I have offset y.val=0 by -480 to get the photo to stop on the bottom of the screen.


Note: to get the photo to stop at coordinates 0,0 there is no “=” in the While( …… &&y.val<480).
   tempNr.val=0
   //x.val=590 //Start of x = End of last x (590)
   y.val=0
   while(y.val>=-480&&y.val<480)
   {
     tempNr.val=x.val+120-800 //Start of bounce (-680)
     tempNr.val=tempNr.val*tempNr.val
     y.val=tempNr.val/30 //Sets the bounce width
     if(y.val>=480) //Trim off the bounce tails
     {
       exp0.y=480
     }
     exp0.y=y.val-480 //Top of bounce (0-480=-480)
     n4.val=exp0.y
     h1.val=480-n4.val
     //
     exp0.x=x.val-800
     n3.val=exp0.x
     h0.val=800+n3.val
     x.val=x.val+10 //Speed of bounce
     delay=10 //Slow it down a bit
   }
   //--------------------------------------------------------
   //Note: x.val=800, y.val=480
     delay=3000 //Hold the picture for 3 seconds


Now run Debug and press the Photos button to load a photo. Then press Effect button 11 to test all the Hops work and the photo stops at full screen.

 Great! That got them hopping.

(If things go wrong please recheck the coding from Step 9).


Table of Contents

Nextion Editor - Automating the Transition

10a.gif
10b.gif

To automatically add a transition effect as the photos changes we could adopt ether of the following options:

  1. Copy the Touch Release Event scripts from each of the effect buttons and paste them into a series of if and if else commands in the Photos button script.
  2. Trigger the effect button scripts from a button Touch Release Event using the click command.


As you might of guessed I will be going with option 2.

Now I can explain why I wanted you to add effect buttons in sequence, one after the other. This ensured that the button id’s are sequential from button e0 to e11.

In my case the ids start at 20 for e0 and rise to 31 for e11. To trigger the effect button scripts we will be using the click command. In The Nextion Instruction Set the click command can be used in two ways:

  1. click b0,1 // Trigger Touch Press Event of component with .objname b0
  2. click 4,0 // Trigger Touch Release Event of component with .id 4

Another feature we need to use is the Array[index] (p[ ] and b[ ] represent the page and button arrays):

  1. p[pageindex].b[component.id].attribute // global scope
  2. b[component.id].attribute // local scope on current page

For example to activate button whose id is 25 (i.e. e5 id=25):

  1. click 25,0
  2. or
  3. click b[25],0


Let’s test it out…

Add a new button from the Toolbox, in my case it is b3. Move it to the middle of the screen and change its attribute txt to “Test”. Now write the following code in the Touch Release Event box…

b3(Button) Test Here we are using the random function rand set to range 0 to 11 with randset to represent the effect buttons. The first effect button e0 has an id of 20.
Toolbox, Button, Attribute
	objname		b3
	vscope 		local
	font   		2
	bco    		2016
	text   		"Test"
	ixt_maxl	10
	x      		368
	y      		254
	w      		50
	h      		30
Event, Touch Release Event
   randset 0,11
   n1.val=rand
   y.val=0
   click b[n1.val+20],0


Run Debug and press the Photos button to load a photo. Then repeatedly press and release the Test button and check everything works.

 OK! Now random things are happening.


Continuing on with coding…

To link it up the automatic photo frame transitions we can add the test code to the Serial OFF/ON and Random OFF/ON button timer tm0 script. Timer tm0 was set up in the Rushtp #3 Photo Frame Project Files we downloaded in Step1. The timer triggers the photo changes so all we have to do is add out test code to the end of the Serial ON and Random ON condition scripts.

tm0(Timer)
Toolbox, Button, Attribute
	objname		tm0
	vscope 		local
	tim   		3000
	ewn    		1
Timer Event
   if(b1.txt=="Serial ON")
   {
     FileNr.val++
     n0.val=FileNr.val
     covx FileNr.val,tFileNr.txt,0,0
     if(FileNr.val>=fCount.val)
     {
       FileNr.val=0
     }
     exp0.path="sd0/xi Photos/Photo-"+tFileNr.txt+".xi"
     randset 0,11
     n1.val=rand
     click b[n1.val+20],0
   }    // --------------------------------------------------------
   if(b2.txt=="Random ON")
   {
     randset 1,fCount.val
     FileNr.val=rand
      n0.val=FileNr.val
     covx FileNr.val,tFileNr.txt,0,0
     exp0.path="sd0/xi Photos/Photo-"+tFileNr.txt+".xi"
     randset 0,11
     n1.val=rand
     click b[n1.val+20],0
   }


Run Debug again.

Test the Serial OFF/ON and Randon OFF/ON buttons to check the photo changes and transition effects work.


 Great! More random things are going on now.

*Now you can delete the Test button b3 and save the Nextion file*


Table of Contents

Nextion Editor - Tap on the Screen to Toggle the Controls ON/OFF

11a.gif

Now the controls are all working it would be nice to hide them after the digital photo frame is running.

First add a new Text object t2, or copy and paste the t0 (“of”) object. Then edit the attributes to display the screen instructions. (For txt select multiline… to add the control text)

t2(Text)

 Toolbox, Text, Attribute

	objname	T2
	vscope	global
	font		1
	sta		transparency
	pco		65522
	txt		“Tap on the screen to Toggle controls ON/OFF”
	txt_maxl	100
	x		75
	y		35
	w		700
	h		30


Now add the following code to exp0(ExPicture).

exp0(ExPicture)

 Toolbox, ExPicture, Attribute

	objname		exp0
	vscope		global
	effect		top fly into
	x      		0
	y      		0
	w      		800
	h      		480
 Event, Touch Release Event
   if(visState.val==0)
   {
     vis b0,0
     vis b1,0
     vis b2,0
     vis n0,0
     vis t0,0
     vis fCount,0
     //-----------------------------------------------------------------
      vis n3,0
      vis h0,0
      vis b4,0
      vis n4,0
      vis h1,0
      vis e0,0
      vis e1,0
      vis e2,0
      vis e3,0
      vis e4,0
      vis e5,0
      vis e6,0
      vis e7,0
      vis e8,0
      vis e9,0
      vis e10,0
      vis e11,0
      vis t1,0
      vis n1,0
      vis bID,0
      vis t2,0
     //-----------------------------------------------------------------

     visState.val=1
   }else
   {
     vis b0,1
     vis b1,1
     vis b2,1
     vis n0,1
     vis t0,1
     vis fCount,1
     //-----------------------------------------------------------------
      vis n3,1
      vis h0,1
      vis b4,1
      vis n4,1
      vis h1,1
      vis e0,1
      vis e1,1
      vis e2,1
      vis e3,1
      vis e4,1
      vis e5,1
      vis e6,1
      vis e7,1
      vis e8,1
      vis e9,1
      vis e10,1
      vis e11,1
      vis t1,1
      vis n1,1
      vis bID,1
      vis t2,
     //-----------------------------------------------------------------

     visState.val=0
   }


Run Debug to ensure tapping the screen toggles the controls ON/OFF and it all works.


Table of Contents

Nextion Editor - Add a Frame Delay Control 1 - 9 Seconds

12a.gif

The timer tm0 (Timer) was set to trigger every 3000 milliseconds (i.e. 3 seconds).
Well, we can change that value during run time in Debug by adding a Slider control to change the trigger time in the range 1 to 9.9 seconds.

Leave the timer tm0 (Timer) set to trigger every 3000 milliseconds. this will be the default setting.


Now carry out the following:
(I am not going to use my shorthand tables to show you the Attribute and Event settings. You should now be able to set them up yourself from the brief instructions below):

Add t3(Text), x0(Xfloat) and t4(Text) objects from the Toolbox
  - For all three objects set the sta=transparent, font=1, and pco=65535 white
  - Set t3’s xcen=Right and txt=“Frame delay”
  - Set t4’s xcen=Left and txt to “Seconds”
   (Adjust the txt_maxl, w and h values to suit)
  - Set the Xfloat x0.val to 3000
   (Adjust the w and h values to suit)
  - Align the 3 objects in a clear space on the screen
   (Use the Align tools below the top menu bar)
Add h2(Slider)
  - Set it global, horizontal
  - bco = 0, bco1 = 0 and pco = 65535
  - val = 3000, maxval = 9900 and minval = 1000
  - In the Touch Move event add tm0.tim=h2.val and x0.val=h2.val/100
  - position it below the line of text
Add more code to the exp0(ExPicture) Touch Release Event to toggle these new controls ON/OFF
  - vis t3,0   vis x0,0   vis t4,0   vis h2,0
  - vis t3,1   vis x0,1   vis t4,1   vis h2,1


Right, now run Debug.
Set the slider to 1.0 seconds and set the Serial button to Serial ON. The picture increase the speed of the photo change.
Move the slider to 9.9 seconds and the picture change should slow down.
Finally click on the screen to toggle the controls ON/OFF.


 Good! Everything should now be working.


(If things are not working out for you, you can download the project files – See Step 15)


Table of Contents

Nextion Editor - Upload to a Nextion Intelligent 7" Touch Screen

13a.gif
13b.gif

Finally, select Upload to update the Nextion Intelligent 7" Touch Screen

In the Program.s tab above the display screen set baud=921600 //Configure baudrate.

Then I did an Upload with the Baud Rate set to 921600 onto the Nextion Intelligent 7" Touch Screen (e.g. NX8048P070-011C) using my USB to TTL CP2102 UART Module 5Pin Serial Converter.

     …it took about 4 minutes! …so time to pour a cold beer.

PS: If you have not disconnected the touch screen and closed the Nextion Editor the next upload only takes a few seconds to complete.


Table of Contents

Summing Up…

14a.gif
14b.gif

The Photo Frame Algebraic Transition Effects Work.

In this project I demonstrated how to create advanced transition effects based on algebraic formulas “x,y functions” controlling the ExPicture frame’s x and y values without having to use page refreshing.

I also demonstrated the function effects in MS Excel charts.


  In the next project, and the last in the Photo Frame series, I will show how to:
    • Set up a Data file on the micro SD card
    • Use the mouse to drag the ExPicture frame around
    • Record the dragging movement in the data file
    • Play back the data to create bespoke transition effects


Note: the Nextion display will not need to be re-programmed to add or change the photros. Just resize (800x480 pixels) and convert to “.xi” file format and put them on the SD Card.


Table of Contents

Download Worked Example

15a.jpg
15b.jpg

You can download the Nextion HMI file and Photo files for this project using the links below.

It is important that you read the notes shaded in green before starting downloading...

Rushtp5.txt

Note: This file has been saved as a .txt file because some web browsers will not allow .HMI files to be downloaded! You will have to rename the downloaded Rushtp4.txt file as Rushtp5.HMI before you can open it with the Nextion Editor.

Photo-1.txt, Photo-2.txt, Photo-3.txt, Photo-4.txt, Photo-5.txt, Photo-6.txt, Photo-7.txt, Photo-8.txt, Photo-9.txt, Photo-10.txt, Photo-11.txt

Note: These files have also been saved as a .txt files. Rename them as Photo-1.xi, Photo-2.xi,,,etc. Then copy them into a new "xi Photos" folder in the Nextion Editor Virtual SD Card folder. You will also have to copy the "xi Photos" folder onto the SD Card on the Nextion Intelligent Display before Uploading the Nextion TFT file.

Top Tool Bar

 File, Virtual SD Card Folder

   

	folder		sdcard0
	new		Folder
	folder name	"xi Photos"
	add files	“Photo-1.xi”
			“Photo-2.xi”
			“Photo-3.xi”
			etc...


Open the Rushtp5.HMI file in the Nextion Editor. and SaveAs Rushtp #5 - Nextion Intelligent - Photo Frame Algebraic Transition Effects.HMI.

This file was developed for the Nextion Intelligent Series 7” display screen. To modify it for other size screen, or to include your own images, you will have to follow the whole Rushtp #3 - Nextion Intelligent - Photo Frame ExPicture Files From the SD Card project making adjustments for your screen size, and photos.


Table of Contents