Go Down

Topic: Save data with Processing to .CSV (Read 6 times) previous topic - next topic

deviukk

No reason for doing that, thought it would matter.

But the value is ok, only problem is that the values in the file don't fluctuating the same as the normal analogRead() outputs

WillR

#16
Mar 28, 2011, 08:16 pm Last Edit: Mar 28, 2011, 08:19 pm by WillR Reason: 1
Here is a suggestion...

Put a loop in your Arduino program so you only send say 10 values.  --- sorry , LINES!

Also include a "packet number/line number field"... say the first value in the record-- just count from 1 upwards...

If you send 10 records -- do you receive the same 10?

If you send lots of records -- do you start "dropping" packets? You can tell by the line number....

If you name the file as a CSV extension, you can clearly read it into Open Office or Excel. I am sure you have one of those -- or could get it.


If you are "dropping Packets" you could speed up or slow down the BAUD rate to see if it makes a difference....

Also you could implement a Protocol Like XON/XOFF -- a lot harder -- unless there is a library...

Or you could pay attention to Hardware Handshake on the PC -- through a standard RS232C port ... Nt that tough -- but you need the interface...

Just another Hacker

WillR

I do this through UDP and Delphi from Arduino -- it has its own set of problems and it does drop packets.

If you turn off the Serial Logging to the Consoles -- then I think the Packet Dropping could disappear if that is the issue.

Regardless -- I think numbering packets is a good idea -- and monitoring it -- so you can judge if the program is behaving and assess if the dropout rate is acceptable.

I think it is good practice to guard against dropout if you are transferring data.  Opinions may vary...
Just another Hacker

deviukk

Thx for the help and suggestions!

I'll try what you told me.

WillR

Just another Hacker

wildbill

Move that output.println line out of draw and into processByte. Like this:
Code: [Select]

void processByte( int inByte) { 
  serialInArray[serialCount] = inByte;
  serialCount++;
  if (serialCount > 2 ) {
    meas1 = serialInArray[0];
    meas2 = serialInArray[1];
    meas3 = serialInArray[2];
    output.println(map(meas1, 0, 255, 0, 1023) + "," + map(meas2, 0, 255, 0, 1023) + "," + map(meas3, 0, 255, 0, 1023));
    serialCount = 0;
  }
}


Where you have it now, it gets called every time you read a byte and that means that only one of the measure variables has changed

deviukk


Go Up