Saving data from Arduino to PC

I am a newbie to arduino.

i am building a counter to find the number of likes and unlikes (kind of feedback system) which uses only push buttons connected to the digital pins. In this process i want to save the entries as a .csv file directly into my PC and generate a small pie chart to compare likes and unlikes. I tried PLX DAQ but it requires some more coding.
Do we have any direct command which can save data as .csv??

thank you.

#define like 4 // choose input pin for like
#define unlike 6 // choose input pin for unlike

int yes=0, no=0; // variable to count

void setup()
{
  pinMode(like, INPUT);
  pinMode(unlike, INPUT);
  Serial.begin(9600);
}

void loop()
{
  if(digitalRead(like)==LOW) // when like button pressed
  {
    yes=yes+1;
    delay(2000);
    Serial.flush();
    Serial.print("likes=");Serial.print(yes);
    Serial.print(",,,,,,,");
    Serial.print("unlikes=");Serial.println(no);
  }
  if(digitalRead(unlike)==LOW) // when Unlike button pressed
  {
    no=no+1;
    delay(2000);
    Serial.flush();
    Serial.print("likes=");Serial.print(yes);
    Serial.print(",,,,,,,");
    Serial.print("unlikes=");Serial.println(no);
  }
}

Do we have any direct command which can save data as .csv??

No. The Arduino can't make some device on the other end of the serial port do anything.

You might want to look at GoBetwino if you are using windoze.

PaulS:

Do we have any direct command which can save data as .csv??

No. The Arduino can't make some device on the other end of the serial port do anything.

Really? Isn't that kind of the whole point of the serial port? I send commands over serial to make my GPS module do things. (I think I know what you must have meant....but it just sounds much more general.)

You might want to look at GoBetwino if you are using windoze.

That looks interesting.

Rajeev -
If you don't want to have to use or code something else on the PC side, and dont need it to work "live", you could just write a CSV file to an SD card. Then, use SD card to load file into Excel.

Isn't that kind of the whole point of the serial port?

No. The purpose of the serial port is to allow for the transfer of data. Something must be on the other end of the serial port, listening to the data. That thing must understand what the data is trying to tell it to do, and make the PC then do what the Arduino wanted to have done.

There is nothing magic that is making serial data do something on the PC.

I send commands over serial to make my GPS module do things.

No, YOU don't. You use an application on the PC to send data to the serial port. The GPS has code running on it that understands the serial data, and properly interprets it.

PaulS:

Do we have any direct command which can save data as .csv??

No. The Arduino can't make some device on the other end of the serial port do anything.

You might want to look at GoBetwino if you are using windoze.

Thank you...
it is working...
applying trail and error method to frame .csv file

1ChicagoDave:

PaulS:

Do we have any direct command which can save data as .csv??

No. The Arduino can't make some device on the other end of the serial port do anything.

Really? Isn't that kind of the whole point of the serial port? I send commands over serial to make my GPS module do things. (I think I know what you must have meant....but it just sounds much more general.)

You might want to look at GoBetwino if you are using windoze.

That looks interesting.

Rajeev -
If you don't want to have to use or code something else on the PC side, and dont need it to work "live", you could just write a CSV file to an SD card. Then, use SD card to load file into Excel.

Tutorial 11 for Arduino: SD Cards and Datalogging – JeremyBlum.com

Thanks for the reply.... :slight_smile:

PaulS:

Isn't that kind of the whole point of the serial port?

No. The purpose of the serial port is to allow for the transfer of data. Something must be on the other end of the serial port, listening to the data. That thing must understand what the data is trying to tell it to do, and make the PC then do what the Arduino wanted to have done.

There is nothing magic that is making serial data do something on the PC.

I send commands over serial to make my GPS module do things.

No, YOU don't. You use an application on the PC to send data to the serial port. The GPS has code running on it that understands the serial data, and properly interprets it.

NO! Actually, I use my nervous system to send impulses through nerves to the receptors connected to muscles connected to the bones in my fingers causing them to move in a way that causes the skin covering those muscles & bones to apply pressure to the plastic key covers on the keyboard on my MacBookAir to close switches in a desired order which send signals to another part of the MacBook which translates those signals into instructions an operating system on my MacBookAir further translates into commands for the Arduino IDE application which is being visually represented by a set of pixels (and illuminated by a cold cathode tube) through an LCD device attached to the MacBookAir's motherboard. This causes the Arduino IDE to load a sketch (or transfer specific data) through the operating system to hardware connected to a USB connection, down a USB cable, into a female USB connector, processed by the transistors & bits of an Atmel ATMega16U2 IC, which sends that information through copper traces to connector pins to be stored onto the ATMega328P IC on the Arduino UNO PC Board. This causes the IC (when powered on) to manipulate a series of internal FETs connected to its external pins to repeatedly send a particular ordered set of high & low voltage signals to the wires connecting from its pins to the board on which lies the GPS module. That PCB then relays those voltages through thin strips of copper to the pins on the GPS module carrying them through to transistors inside the module which hold a series of bits that react in a particular, and predictable, way to different ordered sets of voltage changes and cause something (that I wanted to happen) to happen.

I guess we were both wrong. :zipper_mouth_face:

Cool Gobetwino worked well...
even the problem with alignment solved when i used
Serial.print(',');

Now struggling to get a dynamic graph sheet from that sheet....

PaulS:

Do we have any direct command which can save data as .csv??

No. The Arduino can't make some device on the other end of the serial port do anything.

You might want to look at GoBetwino if you are using windoze.

Thank you Pauls,
Gobetwino is really helpful. :slight_smile:

if u have a ethernet shield u can upload data and download it in csv , json or xml or simply create chart from aquired usind my application

an example for temp upload
http://www.dataino.it/help/document_tutorial.php?id=5

and chart creation http://www.dataino.it/help/document_chart.php

ciao

how to read character or a word from csv file ,

Open it in Excel