Pages: 1 [2]   Go Down
Author Topic: Save data with Processing to .CSV  (Read 5600 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Georgina Ontario
Offline Offline
Sr. Member
****
Karma: 5
Posts: 437
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...

« Last Edit: March 28, 2011, 01:19:00 pm by WillR » Logged

Just another Hacker

Georgina Ontario
Offline Offline
Sr. Member
****
Karma: 5
Posts: 437
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Just another Hacker

0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thx for the help and suggestions!

I'll try what you told me.
Logged

Georgina Ontario
Offline Offline
Sr. Member
****
Karma: 5
Posts: 437
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Forgot this...
http://arduiniana.org/libraries/newsoftserial/

It has handshaking if that becomes an issue.
Logged

Just another Hacker

New Jersey
Offline Offline
Faraday Member
**
Karma: 65
Posts: 3638
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Move that output.println line out of draw and into processByte. Like this:
Code:
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
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thx! That did the job smiley

Logged

Pages: 1 [2]   Go Up
Jump to: