Start a new topic

GPIO Ports doesn't work (But actually Do)


If I edited in the Sample Editor V0.38th version the GPIO commands are working well, but with the V.039-V.042 version doesn’t worked at all, when I want to use it.

I used these commands, example:

cfgpio 0,2,0


Thanks your help,


(755 KB)

Please post v0.38 HMI where GPIO is working and you use as comparison to working - not working


If I upload this file, to display with V0.38 Nextion Editor then GPIO port working correctly,

but I upload same file with V.039-V.042 Nextion Editors, GPIO port not working.

Thanks in advance,


(733 KB)

I do not have an explanation yet,

I am not certain of your configuration beyond the Nextion code. 

I can say that when I upload my GPIO code into v0.42 mine works.

My Nextion Player Piano is using PWM configuration - IO 7 works

My Nextion Tilt game using input binding - IO 0,1,2,3,4,5 works

Turning on or off the LED in output mode - IO 6 works.

I am not switching pages in my code, but until my adapters and

spare FFC cables arrive, my IO 0 is just a button.  I'll think more.

You can test upload of v0.38 TFT and upload of v0.42 TFT

back and forth to confirm again what you are experiencing

perhaps rule out an FFC connection issue. I'll think some more.

Ahh, so this a bit risky here.

I am going to call your bluff and say that your code never worked under version v0.38 or v0.42 as you provided via the two HMIs above.  Now my configuration via an expansion board may be different than

your configuration - which you have failed to provide any details on your external gpio setup.

However, I have taken working gpio configs from v0.38 HMIs and loaded into v0.42 Editor, rebuilt, and uploaded - and it works.  This goes for the various modes gpio modes offered by Nextion.  So about the only way I can be incorrect here, is that your FFC cable became damaged or something in your external gpio setup has failed.  But I would put my money on your code never having worked from the get go.

I honestly I feel like I have had my day wasted searching for a Bug that isn't there all because your original code did not work.  You dump your HMI and claim a Bug.  This means me downloading your HMIs, opening and having to review your source.  Having to check multiple versions of Nextion Editor, perhaps on multiple Nextion devices for multiple gpio configurations to rule out one by one, and waste time recording to make my point so all users on the Forum do not think GPIO is messed up because of an incorrect claim.

I arrive at the conclusion that the Nextion GPIO remains unaffected by v0.42 update.

Reporting non working code as a Bug hoping for the correct code to be revealed is the wrong approach as it truly wastes so much more of our time than having had just simply asking a question in Free Chat. 



I will want to see evidence of your v0.38 code working as you provided in the v0.38 HMI.

Provide some evidence of your external setup on IO 0 working in defense of your claim.

Besides all the testing, you can see in the video I probably managed to accomplish the result you were after, but for posting your question in the form you did under Bug Reports, it will not be me to show you how.


Thank you for a quick answer.

A maked the video about my problem.

Please see attached link:

I can not compare Apples to Apples when you use a new Banana.

The video you post does not use the same HMI files as you provided.

The HMI files you provided above contain

- two background pictures Blue 480x320 number #0 and #1,

- green button #2 and red button #3

GPIOTest.HMI as posted Above is v0.42 format for 3.5" Enhanced

GPIOOK.HMI as posted Above is v0.38 format for 2.8" Enhanced

What you show in the video for version v0.38

uses HMI name GPIO_OK_320x240.HMI

 - this is format 3.5" Enhanced

 - only two pictures Green #0 and Red #1

 - White background

How can I comment on the code not show and that I do not have

You did not provide GPIO_OK_320x240.HMI

- this is evident by the white background and only two pictures.

- many things could have changed.

If you use code like you showed in the files you uploaded

page0 b0 Touch Press Event

   Send Component ID

   page 1

   cfgpio 0,2,0


page1 b1 Touch Press Event

   Send Component ID

   page 0

   cfgpio 0,2,0


How would this code ever be expected to work?

I would expect the code to do exactly as programmed.

Press b0

  - Send Component ID

  - changed page to page1

Press b1

  - Send Component ID

  - changed page to page0

Press b0

  - Send Component ID

  - changed page to page1

Press b1

  - Send Component ID

  - changed page to page0

Where can the HMI ever reach gpio config or set pio0


The previous HMI files contain the same GPIO command.

The final version has simplified the picture to be smaller in file size.

Thanks in advance,


Here would be a more proper way of doing this across pages.

 - configure your gpio in your first page preinitialization of your HMI

 - not on the fly in buttons and expect no errors

 - page changes in button release as last command

 - set pio0 on page post init, to reflect state

   - but to drilling with reconfiguration on gpio pin mode.

page0 Preinitialize Event

  pio0=0          // pre-set pio0 to off

  cfgpio 0,2,0  // set IO 0 to push pull output mode

page0 Postinitialize Event each time page is loaded

   pio0=0         // set to off (as red off button is here)

page1 Postinitialize Event each time page is loaded

   pio0=1         // set to on (as green on button is here)

page0 b0 Touch Release Event

  Send Component ID

  page 1          //  page changes on release - last command

page1 b1 Touch Release Event

  Send Component ID

  page 0          //  page changes on release - last command


Works for me,

  light off on loaded

  light on when page change with green button

  light off when page change with red button

(152 KB)


Thank you for your instructions, so you can really work.

Problem is solved .

Thank you,

hi, i have a similar problem, with the last version of nextion editor, i ignore back versions what to do it, i try to use with button and double state button, i need activate or deactivate various reles but only can activate, i don't know what to do, 

When i try with simple button i put:

touch press event

cfgpio 0,2,0


touch release event

cfgpio 0,2,0


I try various with variables also, and always do the same, whith conditions, etc

Thanks for your help 

User coding does not belong in Report a BUG

  this is not a firmware issue