I have a weird bug in my code where I get a bunch of random symbols at the start of my serial buffer. From Processing I write to serial using the following method:
I am running the Arduino via Processing, and get back this from the Arduino (from the code above):
I pasted this as an image because for some reason Processing won't let me copy the output. Anyways, normally I don't put the ### but tried to use it as a remedy. It makes no sense to me that all these other random characters are at the beginning of the buffer and even separates the #s. Anyone have any idea why this could be? I do Serial.flush after reading the bytes each time. Note: the numbers are correct after the third #
Which is indeed what the number should be (note this number isn't necessarily the same as in the first post). However, from Arduino I now receive:
I've googled a lot on this issue and haven't found anything that has helped (as in I've tried what was mentioned but nothing has changed, including using Serial.flush())
I've googled a lot on this issue and haven't found anything that has helped (as in I've tried what was mentioned but nothing has changed, including using Serial.flush())
Processing sends something. The Arduino gets that, and sends something back. What you get back is not what you expect, so you assume the problem is with the Processing snippet. So, why are you asking about that here?
If you think that the problem is with the Arduino code, where the hell is that code?
I didn't say that I assumed it was Processing, I honestly have no idea what it is. The Arduino code that is important and is outputting the line I mentioned is in my first post... I can post more code but posting all of it would be unnecessary and a lot of lines to read through. Here's how I setup:
void setup() {
Serial.begin(9600);
}
And then within the loop at this moment is is processing these lines of code for this output:
I know, I'm just hesitant since it is for research and I'm not sure if I'd get in trouble about IP. Anyways, I actually figured out the issue. Changing
char bytes[60];
To
char bytes[60] = {0};
Removed all the random characters. The fact that the numbers were processed incorrectly was a decimal issue (i.e. 10.34 is 110 + 01 + 30.1 + 40.01) and I fixed that too. Thanks for the advice.