Start a new topic

I don´t know how activate or deactivate with gpio

Hi all, sorry for my bad english, i try use gpio I/O with a button or doubleStateButton, but only can activate, after always stay activate, its think very simple, cfgpio 1,2,0 for output and  piox = 1 or 0, how do you do it?

Thanks


" and  piox = 1 or 0"   With that syntax, you should normally get a compiler error or warning in the IDE, spaces are (as far as I know) not allowed or useful here. Try with pio1=0

Sorry, of course I do not put it like this, I put pio = 0 or pio = 1,

I can only activate a few, once activated are not deactivated, where I place the orders and how ?, Thank you 

"I put pio = 0 or pio = 1"
As Thierry stated

  your usage would case a compile error 

  pio = 0 or pio = 1 is invalid


"can only activate a few"

 - there are only eight, and all eight can be activated/deactivated


"once activated are not deactivated"

  - by your choice, set and leave on in your design, or other

  - can indeed be deactivated at will with command


"where I place the orders and how?"

  - refer to the Nextion Instruction Set

  - where order and how is programming, use as necessary to achieve result



I wonder how people with an obvious lack of even elementary programming skills feel „gifted“ to develop simple I/O routines... Programming is first about logic, strategy, and algorithm. Only if one has the whole picture in theory, then one might chose the tools for realization, i.e. the hardware, the programming language etc., depending on the required specifications from the first step. And then, only then, one might start writing the very first line of code. Apparently, many people buy a MCU (most times Arduino) first, then peripherals, before thinking what they want to realize and without knowledge how to do so. They start then a wild #include thing with libraries whose inner working they don‘t understand, then copy and paste or trial and error in programming languages which they don‘t master and which they don‘t want to study systematically... I guess that 95% of the postings in these forums were basically obsolete if people had learnt C/C++ at least the small part from the Arduino reference pages, if they had looked at the source code of the Nextion library, and if the had thoroughly studied the Nextion instruction set and the code from the example HMI files...

1 person likes this

How is it that in 2017, that people don't know how to use a search

image


Top of every page in the forum !!!

@Raul Cruz: if the Nextion is connected to your PC with a prolific USB / TTL adapter, you might issue all commands for testing purposes manually from the bottom part of the IDE and see the Nextion‘s answer in real time.

First project in Arduino is hidef cam for face recognition without knowing a lick of code. =)

 - 1748 page Reference Manual's - oh hell no, we be Men!


1 person likes this

I wonder why you need to be told everything that puts each one, when asked how you do it, I thought that many things were taken for granted in each of my posts, it is supposed to be how it is done and where it is placed Every order, and that you understand it well, your answers seem like they do not want to help, and I'm sorry if I offended you, I thought you were cleverer, I'm sorry.



After this, and if you want to help me, I tell you how I do it: The first thing I have to say is that I copy the file to an SD and load it to the screen, it is connected to a base of 8 reles by means of the I / O of the screen gpio. No arduino use or anything else. The test I performed in a program already started long enough in which I added a dualStateButton. The orders I give are these,

In bt0, touch release event( i try for many ways, one is that)


cfgpio 0,2,0

cfgpio 1,2,0

cfgpio 2,2,0

cfgpio 3,2,0

cfgpio 4,2,0

cfgpio 5,2,0

cfgpio 6,2,0

cfgpio 7,2,0

pio0=1

pio1=1

pio2=1

pio3=1

pio4=0

pio5=0

pio6=0

pio7=0



I have put different departures in the relievers to see what result has, that is the last test


Thanks and sorry,



For more information, I have a 3.2 " nextion, controlling 4 terrariums with an arduino mega r3 with the 95% of memory occupied, now I'm working on an improved version with this new 7" screen and a lot of code I'm doing on the same screen nextion , More than one would like to get to do this without having no idea of ​​programming, it only took me 8 months to learn to do what I have done, and you would be impressed, thanks


I translate all with google, sorry




Patrick Martin, I put this problem in bugs because I thought it was a hardware problem or nextion compilation, not all of us are newbies already. And sorry again. I'm from Barcelona, now here are more important things, Nice to meet you all

Al the cfgpio configuration stuff does not need to be in a touch or release event, it should be done only once in the page load event. Reconfiguring them over and over is a waste of Nextion CPU cycles. In the touch event of the button, you should only write the pioX registers to set them for example to 1 in the button‘s touch event and to 0 in the release event. During development, you really should connect the Nextion directly to the PC and send manually bkcmd=3 from the IDE to the Nextion, so that you get correct feedback in the debug window. Then you might also send your pin commands manually and read the Nextion‘s answer byte sequence. From that you will see what goes wrong. Using a SD card to program the Nextion is only the second best idea, tft upload takes more time and you have no means to see feedback on your computer. Don‘t they teach English in Spanish (or rather Catalonian) Highschools? I thought that English as the first foreign language was a common standard in the European Union for a long time. At least it was when I went to Highschool in France and Germany in the late 1970s. And on the technical institute of the university where I studied mathematics, most technical books were in English, impossible to get a diploma without fluent English...
And bug reports are only for real bugs in the hardware or firmware of your Nextion. Filing a bug report means that you try first to run your code on another Nextion HMI (a professional developer has always 2 or 3 in the drawer for differential diagnose), and then, if you are sure that there is a problem from Nextion side, you upload correct code which allows everybody to reproduce the problem. But up to now, we have no proof that your code is error free.
Schematics can also be helpful. Perhaps you kill the GPIO pins of the Nextion because the relays draw too much current from them? Or there is an over voltage problem from inductive load when switching relays off without free run protection diodes? The community and the moderators in these forums can only help if all details are known.

When the answer is already posted

- it is the users domain to read first what is already written.

The forum has answered just about every possible Nextion question two or more times.

In rare occasion, the user asks a unique question.

So it is not that this answer is not been given.


Problem is when forum will take and turn into personalized help me write my code tech support.

This ignores the 1000's of hours I have spent writing out answers already.


More than one would like to do projects without programming the Nextion

 - and very simply done by checking the Send Component ID

image

This will mean no programming Nextion side- but still means programming

chosen MCU in chosen programming language using chosen compiler, IDE and toolset.


Reading is still required, especially existing documentation.

Nextion Instruction Set

AVR Mega Documentation

etc


But also documentation of the relays, which probably draw 20ma each and 8 will overload many MCU ports trying to draw 160ma - such would be a good reason why reading is most important before attempting to implement.  User error doesn't then become a warranty issue.


Programming Logic requires thought before hand.

An MCU will only do exactly as told - even if such command will destroy it.

But there are many resources on the net for learning Programming

Thanks Thierry,


In the touch event of the button, you should only write the pioX registers to set them for example to 1 in the button‘s touch event and to 0 in the release event"


That is the first way was i try.


"And bug reports are only for real bugs in the hardware or firmware of your Nextion. Filing a bug report means that you try first to run your code on another Nextion HMI (a professional developer has always 2 or 3 in the drawer for differential diagnose), and then, if you are sure that there is a problem from Nextion side, you upload correct code which allows everybody to reproduce the problem. But up to now, we have no proof that your code is error free."

I did't know sorry


My base of reles are Octocouplers, i don't know if that is enougt.


"During development, you really should connect the Nextion directly to the PC and send manually bkcmd=3 from the IDE to the Nextion, so that you get correct feedback in the debug window. Then you might also send your pin commands manually and read the Nextion‘s answer byte sequence. From that you will see what goes wrong. Using a SD card to program the Nextion is only the second best idea"

 I am thinking of communicating in this way to prove the results, I had not raised it so far, what cable I need, in this if I am a first-timer





Login or Signup to post a comment