# Showing variable value + text in one single line

**URL:** <https://discourse.processing.org/t/showing-variable-value-text-in-one-single-line/8041>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [February 2, 2019, 10:51am UTC](https://discourse.processing.org/t/showing-variable-value-text-in-one-single-line/8041 "2019-02-02T10:51:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cas](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@Cas](https://discourse.processing.org/u/Cas)\
**Post date:** [February 2, 2019, 10:51am UTC](https://discourse.processing.org/t/showing-variable-value-text-in-one-single-line/8041/1 "2019-02-02T10:51:11Z")

</div>

Hello,

In arduino I’m sending the following:

```auto
    Serial.println(float(mlGeschonkenTotaal/1000),1); 

```

This is a results in a number like 0.1 which increases which 0.1 over time.

In processing I would like to draw this number as text on the screen.  
I can send the number but if I want to draw “L” behind the number the text string is shown over two lines whereas I would like it to be shown in one single line:

It starts correct but as soon as I start sending serial the L moves one line down.

 ![56](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/1/107f7ec8283faa3e507bd32cb84c60e16c26c058.png)

Processing code:

```auto
// Example by Tom Igoe

import processing.serial.*;

long ontvangen = 0;
float LGedronken = 0;
float sensorValue;

Serial myPort; // The serial port
String inByte = "0.0";
void setup() {
  fullScreen();

  // List all the available serial ports
  printArray(Serial.list());
  // Open the port you are using at the rate you want:
  String portName = Serial.list()[1]; //change the 0 to a 1 or 2 etc. to match your port
  myPort = new Serial(this, portName, 2000000);
}

void draw() {
  while (myPort.available() > 0) {
    inByte = myPort.readStringUntil('\n');
  }

  background(0, 0, 80);
  fill(255);

  textSize(100);
  textAlign(CENTER);
  text(inByte+" L", width/2, height/2);  

  textSize(60);
  textAlign(CENTER);
  text("Hello", width/2, height/2+100);        

  rectMode(CENTER);
  rect(width/10, (height/10)*8, LGedronken, 55, 7);
}

```

The writing part of the variable is this part:

```auto
  textSize(100);
  textAlign(CENTER);
  text(inByte+" L", width/2, height/2);  

  textSize(60);
  textAlign(CENTER);
  text("Hello", width/2, height/2+100);        

```

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [February 2, 2019, 11:22am UTC](https://discourse.processing.org/t/showing-variable-value-text-in-one-single-line/8041/2 "2019-02-02T11:22:15Z")

</div>

try

`text("my world is big: "+nf(myfloat,1,1)+" cubicmilliinchpersquarehand",10,20);`

---

<div class="post-metadata">

**Author:** ![Cas](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@Cas](https://discourse.processing.org/u/Cas)\
**Post date:** [February 3, 2019, 5:55pm UTC](https://discourse.processing.org/t/showing-variable-value-text-in-one-single-line/8041/3 "2019-02-03T17:55:02Z")

</div>

> [@kll](#):
>
> nf(myfloat,1,1)

This worked, thankyou!
