# Processing and Arduino: how to change color according to the status of a digital input?

**URL:** https://discourse.processing.org/t/processing-and-arduino-how-to-change-color-according-to-the-status-of-a-digital-input/37579
**Category:** Electronics (Arduino, etc.)
**Created:** [June 16, 2022, 2:13pm UTC](https://discourse.processing.org/t/processing-and-arduino-how-to-change-color-according-to-the-status-of-a-digital-input/37579 "2022-06-16T14:13:14Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![samiam85](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@samiam85](https://discourse.processing.org/u/samiam85)
#### Post date: [June 16, 2022, 2:13pm UTC](https://discourse.processing.org/t/processing-and-arduino-how-to-change-color-according-to-the-status-of-a-digital-input/37579/1 "2022-06-16T14:13:14Z")

</div>

Dear All,

I am new in the “Processing world”. I have connected Processing to Arduino.  
What I can do, it is to push a button and activate some Digital Outputs in Arduino.

Now, what I wanna do is: according to the status of an output, how I can “color” a certain square in processing? Let’s say, like a led?

Thanks a lot,  
Samuele

---

<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 16, 2022, 2:28pm UTC](https://discourse.processing.org/t/processing-and-arduino-how-to-change-color-according-to-the-status-of-a-digital-input/37579/2 "2022-06-16T14:28:03Z")

</div>

Hello @samiam85,

There is a tutorial on Electronics here suitable for a beginner:

> **[Welcome to Processing!](https://processing.org/)**
>
> Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts. Since 2001, Processing has promoted software literacy within the visual arts…

Explore away!

`:)`

---

<div class="post-metadata">

### Author: ![RichardDL](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@RichardDL](https://discourse.processing.org/u/RichardDL)
#### Post date: [June 16, 2022, 3:05pm UTC](https://discourse.processing.org/t/processing-and-arduino-how-to-change-color-according-to-the-status-of-a-digital-input/37579/3 "2022-06-16T15:05:14Z")

</div>

As well as that, see (Processing) File, Examples, Libraries, Serial. Try all 5 examples starting with SimpleRead and SimpleWrite.

---

<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 16, 2022, 5:27pm UTC](https://discourse.processing.org/t/processing-and-arduino-how-to-change-color-according-to-the-status-of-a-digital-input/37579/4 "2022-06-16T17:27:51Z")

</div>

Hello,

If you are exploring the examples that come with the Processing IDE take a look at this topic:

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

`:)`

---

<div class="post-metadata">

### Author: ![samiam85](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@samiam85](https://discourse.processing.org/u/samiam85)
#### Post date: [June 17, 2022, 6:10am UTC](https://discourse.processing.org/t/processing-and-arduino-how-to-change-color-according-to-the-status-of-a-digital-input/37579/5 "2022-06-17T06:10:45Z")

</div>

> [@glv](#):
>
> a tutorial on E

Dear All,

thanks a lot for your replies. I’ll go trhough the tutorials, then and I’ll be back to you, if necessary.

Samuele.
