Software Serial Problem (help, please!)

Hi everyone.
Im trying to communicate my raspberry pi with Arduino. All the communication process went ok, but everytime i try to call a function after the communication, all the communication stop working. In other words, the communication only works if there only her in loop, if i try to do anything else (like manipulating the variables that i got in communication), it stop working.
Any ideias what should i do?

Thank you!!!

Any ideias what should i do?

POST YOUR CODE !

Oh, all the "digitalWrites" in the communication part was to see if it was reading everything right.

That code won't link correctly as no blink1 is found.

That's

       while (tag == 0)     
          Timer1.attachInterrupt(blink1, freq_x[p]*1000);
       }

a bad idea as it will wait forever.

There is a blink function, i just didnt put here.
The history about this code is that i tried the communication part first and worked. Than, i started another program and did the control part (of the motor that i should control) and worked too. But when i put it all together, the communication part didnt work anymore.
When i comment the function "calculos", the communication started to work again, so is this function that is not working, but i dont know why.
Actually, any function that i put together with the communication makes this part wont work :\

For the best chance of getting help you should post an example code (in code tags) that is as small as possible, successfully compiles, and demonstrates the problem.

When i comment the function "calculos", the communication started to work again, so is this function that is not working, but i dont know why.

I told you in my last post why. And I agree with gfvalvo that you shouldn't waste our time with code that don't even compile.

 int sentido_x[MAX], sentido_y[MAX], sentido_z[MAX], i, j;
  float freq_x[MAX], freq_y[MAX], freq_z[MAX], tempo[MAX];

As MAX is 500 those arrays will use a large amount of memory. Which Arduino board are you using ?

The code compiles. It's no use sending it all to you because you would need a raspberry pi, her code, and their communication. My intention in putting only that part of the code here was to know if there is any restriction / limitation of the SoftwareSerial library that prevents manipulation of the variables transferred by the communication, 'cause thats where the problem is. Did you get it?

UKHeliBob:

 int sentido_x[MAX], sentido_y[MAX], sentido_z[MAX], i, j;

float freq_x[MAX], freq_y[MAX], freq_z[MAX], tempo[MAX];



As MAX is 500 those arrays will use a large amount of memory. Which Arduino board are you using ?

Arduino uno, but im using local variable, so thats enough memory for this (that why its working if i dont put the function "calculos"). Do you think im using too much memory with this and it dont have memory enough to execute my function?

Did you get it?

The problem is you don't get it. I wrote why your code doesn't work. In this case it has nothing to do with SoftwareSerial (although that is a horrible piece of code that should never be used) but it simply has to do with the fact that you're using interrupt based code without knowing anything about interrupt contexts and interrupt handling in general.
Remove the three lines I posted in my first answer and your communication will work again.

And the code that you're hiding from us makes a difference because you probably have errors there too.

Arduino uno, but im using local variable, so thats enough memory for this (that why its working if i dont put the function "calculos").

The Arduino UNO has 2kB of RAM, so it definitely doesn't have enough memory for this.

pylon:
The problem is you don't get it. I wrote why your code doesn't work. In this case it has nothing to do with SoftwareSerial (although that is a horrible piece of code that should never be used) but it simply has to do with the fact that you're using interrupt based code without knowing anything about interrupt contexts and interrupt handling in general.
Remove the three lines I posted in my first answer and your communication will work again.

And the code that you're hiding from us makes a difference because you probably have errors there too.

The Arduino UNO has 2kB of RAM, so it definitely doesn't have enough memory for this.

I should not even answer you for your rudeness and terrible way of dealing with people (if you were as smart as you think, you would not be here answering forums). As far as I know, this forum is for people with all levels of arduino programming, from basic to advanced. Again, the program compiled, the rest of the code is working (I had tested part by part, as stated earlier).
As for the interrupt part, I really do not know much since I had never messed with timer before. However, I do not believe that this is not working because I already commented this part of the code and even so, when putting the function together with the communication, it did not work. But I do not want any more help from you. I'm sorry I wasted your precious time, Arduino genius.

I should not even answer you for your rudeness and terrible way of dealing with people (if you were as smart as you think, you would not be here answering forums). As far as I know, this forum is for people with all levels of arduino programming, from basic to advanced. Again, the program compiled, the rest of the code is working (I had tested part by part, as stated earlier).

You started to get rude, I was just replying with the same kind of words. Unfortunately it seems that you are help-resistant, at least you tell us that we are all wrong when we tell you that parts of your sketch won't work that way.
We have reason to ask all posters on the forum to provide complete sketches because experience shows that very often the problems are in that parts of the code that is not posted. In your case we find enough problems in the excerpts you posted but you know it better and tell us that we point to the wrong stuff.

I assure you that once the program reaches this part

       while (tag == 0)     
          Timer1.attachInterrupt(blink1, freq_x[p]*1000);

and tag is set to 0 it will never leave this while loop again. The while loop just checks that variable "tag" and this variable is not changed inside the loop. If tag should be changed by that ominous "blink1" function you must declare that variable "volatile", otherwise the compiler may optimize it away.

It's up to you if you want to change this or hang on a sketch that will never run correctly. It doesn't make it better if you start to attack people who wants to help you. If you're convinced that your code is correct although we are telling you the opposite provide facts why you think it has to be the way you've done it.

Regarding the variable definitions I agree completely with Delta_G.

NataliaMendes:
I should not even answer you for your rudeness and terrible way of dealing with people

There was nothing in their reply that could be construed as rude, they took time out of their day to try to help you for free. What a terrible way of dealing with people! You on the other hand:

NataliaMendes:
(if you were as smart as you think, you would not be here answering forums

Great move insulting not only pylon, but every other forum member! See how far that behavior gets you. I guess we must be stupid to waste our time trying to help ungrateful people like you. Thanks for pointing that out.

NataliaMendes:
I should not even answer you for your rudeness and terrible way of dealing with people (if you were as smart as you think, you would not be here answering forums).

Right back at cha, Natalia.