# Timing Problem xxx

**URL:** <https://discourse.processing.org/t/timing-problem-xxx/22180>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [June 26, 2020, 3:29pm UTC](https://discourse.processing.org/t/timing-problem-xxx/22180 "2020-06-26T15:29:34Z")\
**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:** [June 27, 2020, 4:22pm UTC](https://discourse.processing.org/t/timing-problem-xxx/22180/9 "2020-06-27T16:22:52Z")

</div>

> [@mike\_z](#):
>
> It is interesting that the Arduino ‘resets’ after the serial connection is established. How do you know that fact and what exactly is meant by reset? Does that mean the Arduino literally starts over?

The link in my referenced post is no longer valid…

I came across this:

> **[Soft reset on arduino through starting serial comm](https://forum.arduino.cc/t/soft-reset-on-arduino-through-starting-serial-comm/26755/1)**
>
> Hi everyone, I have made my first serial comm program on arduino last weekend. I realized that each time I establish link on the USB serial port by opening serial port file and activating the transmission lines, the arduino resets itself. I know...

I also watch the status LEDs on the Arduino to observe this.

My hardware is a W10 PC and a USB connection (serial over USB) to to an Arduino MEGA 2560 R3.

Just adding this at end of setup worked on my end:  
`delay(1000);`

Your code is sending serial data 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…

With your code the Rx LED is ON **all the time**.

Try this on the Processing side:

> [@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 …

Processing only Tx when there is a state change (see code) and I see the RX light turn on and off only during this change.

`:)`

---

_[View the full topic](https://discourse.processing.org/t/timing-problem-xxx/22180)._
