# Serial Input Text File

**URL:** https://discourse.processing.org/t/serial-input-text-file/8557
**Category:** Electronics (Arduino, etc.)
**Created:** [February 20, 2019, 10:53am UTC](https://discourse.processing.org/t/serial-input-text-file/8557 "2019-02-20T10:53:46Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![OWL28SS](https://avatars.discourse-cdn.com/v4/letter/o/8c91f0/32.png) [@OWL28SS](https://discourse.processing.org/u/OWL28SS)
#### Post date: [February 20, 2019, 10:53am UTC](https://discourse.processing.org/t/serial-input-text-file/8557/1 "2019-02-20T10:53:46Z")

</div>

I am taking data from a pressure sensor from Arduino and I need to save the data in a text file. I am using processing to save the data. I am not able to figure out the code for the continuous saving of the data. Please help, I am just a beginner in the Processing

---

<div class="post-metadata">

### Author: ![Banansplitt](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@Banansplitt](https://discourse.processing.org/u/Banansplitt)
#### Post date: [February 20, 2019, 11:58am UTC](https://discourse.processing.org/t/serial-input-text-file/8557/2 "2019-02-20T11:58:37Z")

</div>

Every time the new info updates or you wanna save the data you can run the save command (for example saveStrings(). If you need further help you can provide the code and I can try to help you.

---

<div class="post-metadata">

### Author: ![OWL28SS](https://avatars.discourse-cdn.com/v4/letter/o/8c91f0/32.png) [@OWL28SS](https://discourse.processing.org/u/OWL28SS)
#### Post date: [February 20, 2019, 1:34pm UTC](https://discourse.processing.org/t/serial-input-text-file/8557/3 "2019-02-20T13:34:17Z")

</div>

```auto
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
int intPin = 0;
Serial TianSerial;
PrintWriter Output;
 
void setup()
{
  println("setup() is running........");
  println(Serial.list());

  println("Serial Port Assigning Started.......");
  TianSerial = new Serial(this , Serial.list()[0] , 9600);
  println("Serial Port Assigning Ended........");
  Output = createWriter("Data.txt");  
}

void draw()
{
  if (TianSerial.available() > 0) 
  {
    char Value = TianSerial.readChar(); 
    TianSerial.clear();
    println(Value);
    if ( Value != -1 ) 
    {
      Output.println(Value);
    }
  }
  
}

void keyPressed() 
{
    Output.flush(); 
    Output.close();  
    exit(); 
}

```

This is what I am trying but the data is not coming properly with the signals of the sensors
