# How do I use Processing to read and write data to an Arduino

**URL:** https://discourse.processing.org/t/how-do-i-use-processing-to-read-and-write-data-to-an-arduino/21113
**Category:** Electronics (Arduino, etc.)
**Created:** [May 20, 2020, 7:58pm UTC](https://discourse.processing.org/t/how-do-i-use-processing-to-read-and-write-data-to-an-arduino/21113 "2020-05-20T19:58:23Z")
**Posts on this page:** 1
**Showing post:** 12

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [June 10, 2020, 7:14pm UTC](https://discourse.processing.org/t/how-do-i-use-processing-to-read-and-write-data-to-an-arduino/21113/12 "2020-06-10T19:14:01Z")

</div>

> [@McLae5](#):
>
> So the old string is destroyed automatically?

Yes, it is eventually garbage-collected when no references point to it. If something still points to it, no, e.g.

```auto
String s = "bar";
String s2 = s;
s = s.replace("r", "z");

```

Now s = “baz”, while s2 = “bar” (the original String object, which still has a reference pointing to it, and won’t be garbage-collected).

---

_[View the full topic](https://discourse.processing.org/t/how-do-i-use-processing-to-read-and-write-data-to-an-arduino/21113)._
