Author Options:

Processing and arduino mess up after 94 lines? Answered

I have a pair of sketches, on arduino and processing, that sends a coordinate to the arduino from a text file.  For some reason, every time it gets to the 94th line of text, it moves one axis indefinately to the side.  No matter what text file, or if I remove the 94th line altogether, or whatever, it always does the same thing. If I start on another line, it goes 94 lines, then craps out.  What's going on?  All numbers are int, if that helps, except in the processing sketch, where theres some strings, to read the text. 

I've changed some integers to floats, but it still craps out at exactly line 94. 


Is this related to the last question you asked, when I told you about buffering and handshaking ?

Did you not implement it ?

Sorta. I mentioned that I found the solution differently. Basically, the arduino sends a 1 when it's ready for the next line of code. I think part of the problem is that the processing sends a ton of unused information. Is there any way to clear the buffer, without using serial.flush();, as that no longer works?

What are you sending to the Arduino ? Are these 94 lines being transmitted with your "1" system ? What's supposed to happen to them in the Arduino ?

1) some one else told me about that on arduino, integers whack out at 94.
2) I'm sending a line of text ex: g1 x87.957 y104.768 f1800
3) the arduino serial.reads for letters, then three numbers after that
, and moves to the corresponding coordinates.
4) the "1" just tells the sketch to send the next line.

There's no need for the system to hang on to the data once its got it - where do you put it ? Post your code.

+1, trying to debug code via a description of the code is like trying to spell check something be read to you.

1) *being, not be
2) I haven't had access to the computer until just now. I'll post it shortly.
3) it shouldn't store the data, I'm asking how to keep it from doing so
4) I fixed the problem already, it was just a problem with the number 94 itself in processing, it messes stuff up. Now it just skips that line of gcode.

Sounds like you may be running out of memory/leak

How do I avoid this? I don't need to store anything other than the current coordinates.