Pages: 1 [2]   Go Down
Author Topic: Simple Program To Access & Store Data in MicroSD card  (Read 3871 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i see. sir. i have a question here. i manage to read the reading from sensor. the reading in display in serial monitor & saved in memory card in csv format. meanwhile, i able to interface it also with processing. display the graph & save in pdf format. the question here. when i run arduino serial monitor, processing graph cannot be plot. vice versa. when i plot graph using processing, i cannot view arduino serial monitor. am i can't view both arduino serial monitor & processing graph simultaneously?
Logged

Cape Cod Mass USA
Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ETX or 0x03 or ^c or Ctrl-C whether it comes from a keyboard, serial port, or any other means is a common terminator character in the C programming I have done.

I am just surprised none of the example programs deal with this obvious problem.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 630
Posts: 49998
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
am i can't view both arduino serial monitor & processing graph simultaneously?
You have one phone. You want to call your wife and your girlfriend at the same time. What do you do?

There can be one PC application on the end of the serial port at a time. Either the Serial Monitor or Processing. Not both.

Processing can print data received from the serial port at the bottom of the IDE window.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 630
Posts: 49998
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am just surprised none of the example programs deal with this obvious problem.
Example programs are meant illustrate how to do things, not be complete, production-ready applications. You are free to develop an example program that illustrates how to stop logging, and submit for review and (maybe, keep your fingers crossed) inclusion in a future version of the library (for whichever library you target).
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You have one phone. You want to call your wife and your girlfriend at the same time. What do you do?

There can be one PC application on the end of the serial port at a time. Either the Serial Monitor or Processing. Not both.

Processing can print data received from the serial port at the bottom of the IDE window.

haha.. i see.. i guest that's the end of my project. by the way, thank you sir. you have helped me a lot. the part of arduino programming is done. just about to fine tune more the source code. by the way, i have one question here. it's about processing source code. for graph example code in the arduino public domain. I able to display the graph. but, the graph just a simple graph. without x-axis & y-axis label. so, how would i to adjust the program so that it comes out with x-axis & y-axis label. is it possible for me to put the x-axis & y-axis label together with the value? here are the files i attached together.


* Graph_PDF.pde (2.97 KB - downloaded 7 times.)
* graph.pdf (2.54 KB - downloaded 13 times.)
« Last Edit: January 04, 2012, 06:22:29 pm by mr_hacker90 » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 630
Posts: 49998
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I able to display the graph. but, the graph just a simple graph. without x-axis & y-axis label. so, how would i to adjust the program so that it comes out with x-axis & y-axis label. is it possible for me to put the x-axis & y-axis label together with the value? here are the files i attached together.
It is possible. Rather than drawing lines from 0 in y to the required height, you need to reserve the area from y=0 to y=some value for the labels, and from that value to the top of the window for the data. That will require that you change how the top of the line is drawn, too.

Similarly, reserve the area from x=0 to x=some value for the labels on the left.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It is possible. Rather than drawing lines from 0 in y to the required height, you need to reserve the area from y=0 to y=some value for the labels, and from that value to the top of the window for the data. That will require that you change how the top of the line is drawn, too.

Similarly, reserve the area from x=0 to x=some value for the labels on the left.

at which section should i place y=0 to y=50 lets say... and the label is light intensity.
Logged

Bute, Scotland
Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What is a good way to STOP logging?  The examples I see such as SdFat\examples\AnalogLogger\AnalogLogger.pde seem to log forever until power goes away or you yank the SD card out of the socket.  It seems to me that pulling the SD card out in the middle of a write could be bad.

I would expect to send a ^c or something to tell the Arduino to stop logging and close the file.  But none of the examples do this and the Arduino language doesn't even seem to have a Stop command.  Am I being paranoid about file corruption.  How do Arduino programmers usually exit loop()?

haha.. i never thought about that. yup. how to send command so that arduino stop logging and close the file. for your information. i've never done programming before. i'm wrote a command by referring the example inside the arduino iteself. but not SDfat. i used the example of SD library only. i have a look a example of SDfat. due to lack of knowledge of c-language, i cannot understand it very well.

about the stop command. i think it has. because i have a look my senior arduino programming, his project take a reading of sensor about 30 seconds intervals for about 5 minutes. however, my senior already graduated. i'll try to reach him tommorrow. if i got a news, i'll tell you. with all, regards. 
In the loop() you could test for a specific character from the Serial Monitor and, as long as it does not exist then keep a variable ( maybe call it 'stop' ) set to zero. While it is zero add another reading to the log. If the specific character arrives then change 'stop' to 1 and no more logging will be done.
Logged

Pages: 1 [2]   Go Up
Jump to: