# 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:** 9

<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 5, 2020, 5:14pm UTC](https://discourse.processing.org/t/serial-plotter-over-bluetooth/22378/9 "2020-07-05T17:14:08Z")

</div>

> [@alexthesmeus](#):
>
> I got that the delay is due to processing refresh rate that should be 30 fps by default.

Default is 60 fps:

> **[draw() / Reference](https://processing.org/reference/draw_.html)**
>
> Called directly after setup(), the draw() function continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called. draw()…

> **[frameRate() / Reference](https://processing.org/reference/frameRate_.html)**
>
> Specifies the number of frames to be displayed every second. For example, the function call frameRate(30) will attempt to refresh 30 times a second. If the processor is not fast enough to maint…

In my example I used serialEvent():  
[https://processing.org/reference/libraries/serial/serialEvent\_.html](https://processing.org/reference/libraries/serial/serialEvent_.html)

You can “buffer” received data into an array in serialEvent():

- use a counter\pointer to element of array
- set a flag to indicate when data is ready
- be sure to reset counter\pointer to element in array

In draw();

- when flag is set you can use that data in draw()
- be sure to reset flag

It will take some effort to work through and understand this; work through it slowly and build on that.

There are many ways to handle serial data; you can also send a buffer all at once from Arduino:

> [@Problem with the use of several sensors, Arduino / Processing](https://discourse.processing.org/t/problem-with-the-use-of-several-sensors-arduino-processing/18118/5):
>
> Hello, Some code I wrote to explore Arduino transmitting data to Processing. It runs fine at a BAUD rate of 1000000. slight_smile I use an Arduino MEGA 2560 R3. 
> 
> > **Arduino Code**
> >
> > // Serial Incoming Test (Arduino Tx) // v1.0.0 // GLV 2020-02-29 long count; void setup() { //Serial.begin(9600); Serial.begin(1000000); delay(1000); Serial.print('\n'); //same as Serial.println() Serial.print("incoming"); Serial.print('\n'); //same as Serial.println() } void loop() …

`:)`

---

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