# \[SOLVED\] Problems sending data from Processing to Arduino through serial port

**URL:** https://discourse.processing.org/t/solved-problems-sending-data-from-processing-to-arduino-through-serial-port/20138
**Category:** Electronics (Arduino, etc.)
**Created:** [April 25, 2020, 2:13pm UTC](https://discourse.processing.org/t/solved-problems-sending-data-from-processing-to-arduino-through-serial-port/20138 "2020-04-25T14:13:10Z")
**Posts on this page:** 1
**Showing post:** 5

<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: [April 26, 2020, 10:26pm UTC](https://discourse.processing.org/t/solved-problems-sending-data-from-processing-to-arduino-through-serial-port/20138/5 "2020-04-26T22:26:16Z")

</div>

Try the “fix” to SimpleWrite:

> [@Processing to Arduino Serial Library Example](https://discourse.processing.org/t/processing-to-arduino-serial-library-example/11143/5):
>
> I modified the existing “SimpleWrite” example to: save and check for the state of mouseOverRect() print state to console only writes serial data once a delay() to wait for Arduino to reset once connected to it; in my case, it is an Arduino Mega 2560 R3. I kept the spirit of the original example intact and left it as a “Simple Write” program. My edit of “SimpleWrite” example so it only sends data once: /\*\* \* Simple Write. \* \* Check if the mouse is over a rectangle and writes the status …

I corrected the link in previous post.

The Arduino code for it is in the examples in the Processing IDE and here:  
[https://github.com/processing/processing/tree/master/java/libraries/serial/examples:](https://github.com/processing/processing/tree/master/java/libraries/serial/examples:)

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/0/01e94de1046115be8021d8715c3c48feb94a0dcc.png)

After all that is said and done you need to get a simple working example going and then start layering more complex code.

Some references:  
[https://learn.sparkfun.com/tutorials/connecting-arduino-to-processing/all](https://learn.sparkfun.com/tutorials/connecting-arduino-to-processing/all)  
[Serial Communication - SparkFun Learn](https://learn.sparkfun.com/tutorials/serial-communication/all) Advanced and only here as a reference

`:)`

---

_[View the full topic](https://discourse.processing.org/t/solved-problems-sending-data-from-processing-to-arduino-through-serial-port/20138)._
