Go Down

Topic: writing to a text file (Read 6318 times) previous topic - next topic

HS_HS

hey....
can some 1 guide me.....
i m reading rssi register of cc1101 using arduino... i want to save the data being read into a text file... any idea??

Grumpy_Mike

Where is the text file going to be held?
on the PC or an SD card?
If a PC then send it down the serial line and have the PC put it into a file.
If on a SD card then write bytes to the card using the standard SD card examples.

HS_HS

on the pc....
could u help plxx.. i m new to arduino programming...

Grumpy_Mike

Just send the bytes you want in the text file to the Serial.print call.
Then have a terminal emulator like putty running on the PC saving everything it receives into a file.
It is a bit of a none question.

Grumpy_Mike

Have you been reading any of my replies?
I did not post that code so why have you faked a quote from me.
Very cross about people faking quotes.

HS_HS

hey sorry... tht was just a mistake.........

i was posting my code..

byte data[5]={12, 13, 1, 14, 15};
String datastring="RSSI";
File dataFile = open("trylog.txt", FILE_WRITE);
void setup()
{
if (dataFile)
{
dataFile.println(datastring);
dataFile.close();
Serial.println(datastring);
}
else
{Serial.println("no");;
}
}
void loop ()
{
}

Grumpy_Mike

Code: [Select]
File dataFile = open("trylog.txt", FILE_WRITE);
You can not open a file on an arduino unless you have an SD card.
You need to just send the bytes to the PC and have the PC create the file and store data it receives into it.

HS_HS

hmmm ... ok thankxxx 4 the help

sphume

Hi, I am not only new in arduino programming but also new in programming. I am trying to write data from the arduino and save it to a text file. All the techniques that are available are not helping in my situation since I am also using a MFC GUI to send commands to the arduino. I want to save the pulses from the encoder without the use of an SD card. Any help will be appreciated.

PaulS

Quote
I want to save the pulses from the encoder without the use of an SD card.

So, where do you expect to save them?
The art of getting good answers lies in asking good questions.

sphume

#10
May 27, 2014, 01:28 pm Last Edit: May 27, 2014, 01:46 pm by sphume Reason: 1
I want to save them in the PC

PaulS


I want to save them in the PC

You need to send data to the serial port, then. But, not "pulses". That is a meaningless term. The encoder sets pins HIGH or LOW. You have some code that reads those states, and determines that the encoder has changed position, increasing or decreasing a value. You could send that data to the PC to be saved.

Then, you need an application on the PC that listens to the serial port, and deals with the data that comes in that port.

The art of getting good answers lies in asking good questions.

sphume

I actually want to stream encoder positions to a text file.

PaulS


I actually want to stream encoder positions to a text file.

OK. Go for it.
The art of getting good answers lies in asking good questions.

sphume

Only if it is possible to do so.

Go Up