# Need help - changeable text screen output

**URL:** https://discourse.processing.org/t/need-help-changeable-text-screen-output/13374
**Category:** Coding Questions
**Created:** [August 14, 2019, 1:58pm UTC](https://discourse.processing.org/t/need-help-changeable-text-screen-output/13374 "2019-08-14T13:58:03Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![waffi](https://avatars.discourse-cdn.com/v4/letter/w/9f8e36/32.png) [@waffi](https://discourse.processing.org/u/waffi)
#### Post date: [August 14, 2019, 1:58pm UTC](https://discourse.processing.org/t/need-help-changeable-text-screen-output/13374/1 "2019-08-14T13:58:03Z")

</div>

how can you output a changing text, which comes via a serial interface on the screen output? the problem is that the first text always stops and then it runs into each other.

example:

```auto
  textSize(100);
  fill(0, 139, 0, 139);
  text(distance, 1000,1400);

```

thanks for the help!

---

<div class="post-metadata">

### Author: ![humayung](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/humayung/32/6089_2.png) [@humayung](https://discourse.processing.org/u/humayung)
#### Post date: [August 14, 2019, 2:35pm UTC](https://discourse.processing.org/t/need-help-changeable-text-screen-output/13374/2 "2019-08-14T14:35:42Z")

</div>

I guess you’re not clearing the previous display? if yes, juts put `background(0)` to clear, put it before the text being drawn onto the screen. I’m not very sure, can you post the working code? just a bit to show the problem.

---

<div class="post-metadata">

### Author: ![waffi](https://avatars.discourse-cdn.com/v4/letter/w/9f8e36/32.png) [@waffi](https://discourse.processing.org/u/waffi)
#### Post date: [August 14, 2019, 2:44pm UTC](https://discourse.processing.org/t/need-help-changeable-text-screen-output/13374/3 "2019-08-14T14:44:23Z")

</div>

hi thanks for the answer and sorry for the bad description.

i’m doing a radar project, with the arduino i send distance to processing and i want to show it there. because background(0) i want to leave it that way, that’s just the background color, right?

i just tried to make an example:

```auto
int test;

void setup(){
     size(1000, 1000);
     }
     
void draw(){
  
  int test=5*5;
  textSize(100);
  fill(0, 139, 0, 139);
  text(test, 300,300);  
  }

```

that’s how it works. but the measured distance always changes or stays away.

I’ll take a picture later to pinpoint the problem.

thank you

---

<div class="post-metadata">

### Author: ![humayung](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/humayung/32/6089_2.png) [@humayung](https://discourse.processing.org/u/humayung)
#### Post date: [August 14, 2019, 2:52pm UTC](https://discourse.processing.org/t/need-help-changeable-text-screen-output/13374/4 "2019-08-14T14:52:16Z")

</div>

You need to clear the previous display to show the next frame. Just draw a background on to it

```auto
int test;

void setup() {
  size(1000, 1000);
  frameRate(3);
}

void draw() {
  background(200);
  float test=random(10);
  textSize(100);
  fill(0, 139, 0, 139);
  text(test, 300, 300);
}

```

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [August 14, 2019, 8:16pm UTC](https://discourse.processing.org/t/need-help-changeable-text-screen-output/13374/5 "2019-08-14T20:16:35Z")

</div>

you could also make a list and add the last value at the top of the list

- Using background(200); too, of course
- the `"\n" +` means line break

Chrisir

```auto
String textResult = ""; 

void setup() {
  size(1000, 1000);
  frameRate(3);
}

void draw() {
  background(200);

  float test=random(10);
  println(test); 
  textResult = test + "\n" + textResult; // !!!!!!!

  showText();
}

//---------------------------------------------------------

void showText() {
  // show text
  textSize(15);
  fill(0, 139, 0);
  text(textResult, 300, 30);
}
//

```

---

<div class="post-metadata">

### Author: ![waffi](https://avatars.discourse-cdn.com/v4/letter/w/9f8e36/32.png) [@waffi](https://discourse.processing.org/u/waffi)
#### Post date: [August 15, 2019, 9:04am UTC](https://discourse.processing.org/t/need-help-changeable-text-screen-output/13374/6 "2019-08-15T09:04:12Z")

</div>

so it works perfectly but unfortunately my text is also covered because i inserted it in the setup.

is there a possibility to put the background in a small field?

Edit:

i took my text from the setup into the loop. now it works 🙂 thank you!

i try to build in the rest and get back to you if i’m still waiting somewhere.

many thanks 🙂
