is this seems okey?

Guys,
I’m developing a system where it needs to update the GPIO data in the form of a char str. say <1000101> and this value can be actually anything, <1001101> <1010101> or what ever… or it can be a fixed <1001101> for a long time (if there is no change in gpio state or operations conditions…) The arduino have to report to another VB app. https://forum.arduino.cc/index.php?topic=523848.new#new This is where I wish to avoid unnecessary data transmission. I need real time data update but actually in realtime if there is no change in any bits then why to send it to the other end? My plan is to do it like this:

//declarations of variables like char[], currentStr[20], prevStr[20], some booleans, ec.

//declaration of other instances and constants

boolean updateRequired = TRUE;
boolean isBusy = FALSE;

void setup() {
   //do the setup and related jobs

}

void main() {
   checkGPIO();
   doOtherWorksNeeeded();
   doAnyOtherWorksAlso();
   makeReport();
   keepAlive();

}

void checkGPIO() {
   check GPIO and make boolean according to that;
   
}

void doSomeWorks() {
   do the works needed and update the booleans;

}

void makeReport() {
   set/flush currentStr = NULL;
   update char[] from booleans;
   construct currentStr[] = <1001101> from char[0] .. char[n];
   if strcmp(currentStr[], prevStr[]) = 1 then //considering 1 means there is a comparison
      strcopy(currentStr[] to prevStr[]);
      Serial.println(currentStr[]);
      updateViaEthernet();
      reset keepalive timer;
   end if

}

void updateViaEthernet() {
   isBusy= TRUE;
   Do updating by opening connect, posting, closing;
   isBusy = FALSE;
}

void keepAlive() {
   isBusy = TRUE
   listen for keepalive
   if keepalive signal received, call makeReport();
   isBusy = FALSE;
   reset keepalive timer;
}

The goal is to make it kind of non blocking… a keepalive timer will keep running as the first bit is for keepalive signal. Thus if no data is sent, still i can get a keepalive (that’s a mandatory part, if no communication between the two, then raise alert) plus if there is already signal, then no need. This will help to make it kind of instant update in PC via event (any update in arduino will be reported automatically). This will still send some data, but not a bunch per second type… What you guys say???

Note: Variables here are just for the sake imaginary. char is represented as and length is not the issue…

Wouldn't it be better if you continued your other thread on this subject, instead of starting a new one?

aq_mishu: I could... just that it's still a different concept... with a dependency of the other thread!! Which means it requires a Cross-Threading :-p

It is much easier to help when you keep all the info for one project in one Thread.

I am certainly not going to jump between Threads to see what has already been said.

...R

aq_mishu: I was thinking to keep sectorized...

Dividing the conversation for the sake of dividing the conversation is just that: dividing the conversation. I cannot imagine why you would believe that would be beneficial.

Thread locked.