wildbill:
Well one thing I suspect is that the output.println...... line is being called every time a byte is read, rather than every three as you're intending, so only every third line is likely to be correct. But that's just a guess: what do you see on the serial monitor, what do you see in the file and how does it differ from what you expected?
I dont see how I have to change that println command
Here is my serial monitor output:
267 323 524
273 313 516
280 314 514
286 338 517
281 316 520
285 328 521
278 319 515
275 326 516
265 314 512
277 315 522
280 334 511
274 320 516
276 331 519
280 324 515
276 329 515
285 323 513
290 327 521
271 334 523
269 316 517
269 320 514
272 327 513
296 330 515
262 318 515
274 320 510
282 325 510
Here is the CSV output:
268.78824,332.97647,505.48236
268.78824,332.97647,505.48236
268.78824,332.97647,505.48236
280.82355,320.9412,505.48236
280.82355,320.9412,505.48236
280.82355,320.9412,505.48236
264.7765,328.96472,509.4941
264.7765,328.96472,509.4941
264.7765,328.96472,509.4941
284.8353,324.95294,505.48236
284.8353,324.95294,505.48236
284.8353,324.95294,505.48236
292.85883,312.91766,505.48236
292.85883,312.91766,505.48236
292.85883,312.91766,505.48236
272.80002,316.9294,501.47058
272.80002,316.9294,501.47058
272.80002,316.9294,501.47058
280.82355,316.9294,509.4941
280.82355,316.9294,509.4941
280.82355,316.9294,509.4941
272.80002,316.9294,509.4941
272.80002,316.9294,509.4941
272.80002,316.9294,509.4941
The values are good, but it seems that the values from the monitor fluctuate much harder..