- #1
Nate Duong
- 126
- 3
Dear everyone,
I trying to save serial monitor in the text file, but I still do not know how, could you please help on this problem?
Here is the codes with random numbers are set up, and I would like you save all data into the text file,
Thank you very much,
Nate Duong,
I trying to save serial monitor in the text file, but I still do not know how, could you please help on this problem?
Here is the codes with random numbers are set up, and I would like you save all data into the text file,
Thank you very much,
Nate Duong,
C:
long Channel1a;long Channel1b;
long Channel2a;long Channel2b;
long Channel3a;long Channel3b;
long Channel4a;long Channel4b;
int count1 = 0;
int count2 = 0;
int n1 = 1000 +1; // +1 is missing count
int n2 = 2 +1;
void setup(){
Serial.begin(9600);
randomSeed(analogRead(0));
}
void loop(){while(count2<=n2){
//Serial.print("nate1\n");
while(count1<=n1){
if ((count1==2)|(count1==1)){
Serial.print(" Q1 I1 Q2 I2 Q3 I3 Q4 I4 \n"); // print out the channels
}
Channel1a = random(300); Channel1b = random(300);
Channel2a = random(300); Channel2b = random(300);
Channel3a = random(300); Channel3b = random(300);
Channel4a = random(300); Channel4b = random(300);
Serial.print(" "); Serial.print(Channel1a); Serial.print(" ");
Serial.print(Channel1b); Serial.print(" ");
Serial.print(Channel2a); Serial.print(" ");
Serial.print(Channel2b); Serial.print(" ");
Serial.print(Channel3a); Serial.print(" ");
Serial.print(Channel3b); Serial.print(" ");
Serial.print(Channel4a); Serial.print(" ");
Serial.print(Channel4b); Serial.print(" \n");
count1 = count1 +1;
delay(500);
}
}
count2 = count2 +1;
Serial.print(" \n");}
Last edited by a moderator: