Well pressing spacebar brought me back to the last page and everything I just wrote disappeared.
Long story short:
It wasn't the String.
Processing did know the difference.
It can tell.
When something prints on the arduino, the serial port is not available and then the printed value goes into a variable.
See the table below.
Printing one at a time, make it unreadable on the other end.
You can't tell one value from another.
Is that 604 from the rightTemp, rightLight, leftEmf WHO KNOWS!
I would have to attach a char to each one or send it before hand so that I know that that value is for that sensor.
That is more complicated than I know how to deal with in processing.
The null character thing is a good idea if it will act exactly as a string to processing. Please add links.
I implemented the 'only make the string when it prints', and that may or may not have help ![]()
I realized you's guys meant the serial buffer on the arduino, and I changed the framerate in processing from 60 (sending every ~16ms) to 20 (every 50ms).
It didn't work.
Then it worked.
And then the result was repeatable!
It still works so that must have been it!
Thanks for the other suggestions too!
Tables:
Assuming the values from the sensors stay the same for the half a second:
112, 123, 234, 1020, 40, 41, 23
Data will be printed and received every fifty ms.
Using a String:
Time ms --- What shows up on screen every fifty ms
050 --- 112, 123, 234, 1020, 40, 41, 23
100 --- 112, 123, 234, 1020, 40, 41, 23
150 --- 112, 123, 234, 1020, 40, 41, 23
200 --- 112, 123, 234, 1020, 40, 41, 23
250 --- 112, 123, 234, 1020, 40, 41, 23
300 --- 112, 123, 234, 1020, 40, 41, 23
350 --- 112, 123, 234, 1020, 40, 41, 23
400 --- 112, 123, 234, 1020, 40, 41, 23
450 --- 112, 123, 234, 1020, 40, 41, 23
500 --- 112, 123, 234, 1020, 40, 41, 23
Which every 50ms I can read that data into their respective variables, knowing that the first one is lightRight, the second is.....
Printing every variable on a separate line:
Time ms --- What shows up on screen every fifty ms
050 --- 112
100 --- 123,
150 --- 234
200 --- 1020
250 --- 40
300 --- 41
350 --- 23
400 --- 112
450 --- 123
500 --- 234
It's slower. How do I know what values what? I would have to add to attach a char to each one or send it before hand so that I know that that value is for that sensor.
That is more complicated than I know how to deal with in processing.
Printing every variable on a separate line outcome 2:
Time ms --- What shows up on screen every fifty ms
050 --- 23
100 --- 23,
150 --- 23
200 --- 23
250 --- 23
300 --- 23
350 --- 23
400 --- 23
450 --- 23
500 --- 23
It only reads one value, then flushes the rest. I've seen both cases happen.
So as far as I'm concerned, unless strings are really this bad they would have taken them out and I'm keeping the strings.
you pissed time and resources away using the String class
This is a tiny sketch, and I'm sure it can handle it, because it is, and they would have taken Strings out if they can't.
PaulS, please do not reply on my post any longer. I do not appreciate your text simulated attitude. You seem upset/frustrated at the code I put up. No thanks.