# Serial plotter over bluetooth

**URL:** https://discourse.processing.org/t/serial-plotter-over-bluetooth/22378
**Category:** Electronics (Arduino, etc.)
**Created:** [July 4, 2020, 2:12pm UTC](https://discourse.processing.org/t/serial-plotter-over-bluetooth/22378 "2020-07-04T14:12:02Z")
**Posts on this page:** 1
**Showing post:** 11

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [July 6, 2020, 12:53am UTC](https://discourse.processing.org/t/serial-plotter-over-bluetooth/22378/11 "2020-07-06T00:53:57Z")

</div>

> [@alexthesmeus](#):
>
> do I have to store relevant milliseconds too? Because if I 'd like to calc heartrate

You can do that! Nice to see you putting a lot of thought into this.

You will have to frame the data string you are sending correctly and terminate with a ‘/n’ (in my example.

Example of received string only:

```auto
// Trim and split an data string Rx from Arduino.
// v1.0.0
// GLV 2020-MM-DD
                  
void setup()
  {
  background(0);
  size(400, 500);
  // Data packet received from Arduino: 
  // t1, d1, t2, d2, ... t=time, d=data 
  String inString = "1000,250,1100,300,1200,375,1300,380,1400,375,1500,300,1600,250,1700,200\n"; // '\n' is a linefeed character 
  print(inString);
  
  inString = inString.trim(); //Works!
  inString = trim(inString); //Works!
  print(inString);
  println("end"); //confirms that '/n' was removed!
  
  println();
  String[] list = split(inString, ',');
  printArray(list);
  
  int [] data = int( split(inString, ',') );
  printArray(data);
  
  stroke(255, 255, 0);
  strokeWeight(5);
  
  for(int i = 0; i< data.length; i+=2)
    {
    point((data[i]-1000)/5, data[i+1]);   
    }
  }  

```

Next step I leave with you. 🙂

`:)`

---

_[View the full topic](https://discourse.processing.org/t/serial-plotter-over-bluetooth/22378)._
