hello,
question 1 :
i'm trying store data of 2 sensors arduino processing in csv/excel file, data of 2 sensors stored in 1 column in csv file. instead of two.
my arduino code goes follows :
int sensorpin = 0;
int temperatuurpin= 1;
void setup()
{
serial.begin(115200);
}
void loop() {
int reading = analogread(sensorpin);
int readingsecond = analogread(temperatuurpin);
serial.print(reading);
serial.print("\t");
//serial.print("");
serial.print(readingsecond);
serial.println("\t");
delay(20);
}
which gives output data in serial monitor :
my processing code put serial monitor value in csv file in 1 column :
import processing.serial.*;
serial myserial;
printwriter output;
int lf = 10; // linefeed in ascii
void setup() {
myserial = new serial( this, serial.list()[3], 115200 );
output = createwriter( "log12.csv" );
}
void draw() {
if (myserial.available() > 0) {
string value = myserial.readstringuntil(lf);
if ( value != null ) {
if (value.length() > 2) {
output.print( value );
}
}
}
}
void keypressed() {
output.flush(); // writes remaining data file
output.close(); // finishes file
exit(); // stops program
}
i want put data sensor 1 , sensor 2 in 2 different columns, should adjust ?
question 2 :
i want monitor data long period of time, therefore have timer reads data csv/excel file given start date, day , hour , minutes , readings should stop given end data: day,hour, minutes.
greetings
question 1 :
i'm trying store data of 2 sensors arduino processing in csv/excel file, data of 2 sensors stored in 1 column in csv file. instead of two.
my arduino code goes follows :
int sensorpin = 0;
int temperatuurpin= 1;
void setup()
{
serial.begin(115200);
}
void loop() {
int reading = analogread(sensorpin);
int readingsecond = analogread(temperatuurpin);
serial.print(reading);
serial.print("\t");
//serial.print("");
serial.print(readingsecond);
serial.println("\t");
delay(20);
}
which gives output data in serial monitor :
my processing code put serial monitor value in csv file in 1 column :
import processing.serial.*;
serial myserial;
printwriter output;
int lf = 10; // linefeed in ascii
void setup() {
myserial = new serial( this, serial.list()[3], 115200 );
output = createwriter( "log12.csv" );
}
void draw() {
if (myserial.available() > 0) {
string value = myserial.readstringuntil(lf);
if ( value != null ) {
if (value.length() > 2) {
output.print( value );
}
}
}
}
void keypressed() {
output.flush(); // writes remaining data file
output.close(); // finishes file
exit(); // stops program
}
i want put data sensor 1 , sensor 2 in 2 different columns, should adjust ?
question 2 :
i want monitor data long period of time, therefore have timer reads data csv/excel file given start date, day , hour , minutes , readings should stop given end data: day,hour, minutes.
greetings
csv? in comma separated values. happens if put comma between them instead of tab?
Arduino Forum > Using Arduino > Programming Questions > Storing data in csv file & putting a timer to read data
arduino
Comments
Post a Comment