# Data from PDE to Arduinio IDE on continual basis

**URL:** https://discourse.processing.org/t/data-from-pde-to-arduinio-ide-on-continual-basis/22310
**Category:** Electronics (Arduino, etc.)
**Tags:** homework
**Created:** [July 1, 2020, 6:58pm UTC](https://discourse.processing.org/t/data-from-pde-to-arduinio-ide-on-continual-basis/22310 "2020-07-01T18:58:23Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![kmot](https://avatars.discourse-cdn.com/v4/letter/k/919ad9/32.png) [@kmot](https://discourse.processing.org/u/kmot)
#### Post date: [July 1, 2020, 6:58pm UTC](https://discourse.processing.org/t/data-from-pde-to-arduinio-ide-on-continual-basis/22310/1 "2020-07-01T18:58:24Z")

</div>

```
"Building" a PDE / IDE connection to pass ongoing and changing data from PC (W10/64) to an Arduino board with an LCD. Eventual goal is an LCD-display clock. *My existing code succeeds,up to a point.*. 
 In the test set-up the send / receive. exchange works for about 25 cycles (1 second per cycle). The display then repeatedly displays an unchanging character from the string, usually the inital character. If I restart the PDE (using the "play" icon) the send / received / display cycle restarts. 
I use the LCD display output for two reasons: (1) The goal is an LCD display, (2) This reduces the problem of a COM port clash between the PDE and IDE; both use COMM 5.

```

Code pasted below, I hope with proper easy-to-read format  
.  
Tom Kane\> please format code with \</\> button \* [homework policy](https://discourse.processing.org/faq/#homework) \* [asking questions](https://discourse.processing.org/t/2147)

------------------ PDE --------------------------------  
\</\>// PDE to send-to-port one character for IDE to read and display.  
import processing.serial.\*;

Serial myPort;

float background\_color;

int loop\_Count;

char count\_Text;

String write\_String;

String slc;

void setup () {

size (500, 500); // Size of the serial window (adjust as wish)

myPort = new Serial (this, “COM5”, 9600); // Set the com port and baud

myPort.bufferUntil ( ‘\n’ ); // Receiving the data from the Arduino IDE

loop\_Count = 0;

}

void SerialEvent (Serial myPort) {

background\_color = float (myPort.readStringUntil ( ‘\n’ ));

}

void draw (){

background (150, 50, background\_color); // inital background colour . . .

```
  loop_Count = loop_Count + 1;

  String slc = ""+loop_Count;

  write_String = slc + " WED";

```

// write\_String = “WED”;

```
  myPort.write (write_String); // send a character to the COMM port

  delay(10000);

```

}

----------------- IDE ---------------------------  
#include \<LiquidCrystal.h\>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

char recv\_Char = ‘K’;

int analogPin = A0;

int buffer\_avail;

void setup() {

Serial.begin(9600);

// Initialise the LCD

lcd.begin(16, 2); //Initialize the 16x2 LCD

}

void loop() {

lcd.clear();

lcd.print(“Read from comm”);

delay(3000);

// variety of codes to try reading from the port

// pick one by üncommented it.

```
// recv_Char = analogRead(analogPin);

  recv_Char = Serial.read();

//

```

lcd.clear();

lcd.setCursor(0,0);

lcd.print("recv\_Char: ");

lcd.print(recv\_Char);

delay(10000);

}

---

<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: [July 2, 2020, 2:12pm UTC](https://discourse.processing.org/t/data-from-pde-to-arduinio-ide-on-continual-basis/22310/2 "2020-07-02T14:12:38Z")

</div>

Hi @kmot, You’ve posted the link to [asking questions](https://discourse.processing.org/t/2147), but you need to do what it says. Please format your code so the whole code appears as code (one for Procesing and one for Arduino). Look at other topics to see how it should be. Then there’s the part about small steps. IMO your project steps should be

- make Arduino print numbers counting continuously on the serial monitor (Ard IDE ctrl-shift-m)
- reformat those numbers to what you expect on the LCD
- put them on the LCD

When that is all working then think what you want the PC and Processing to do. Your choice of words “PDE / IDE connection” indicates confusion to me, PDE = Processing sketch, IDE = Arduino IDE - why would you want them to communicate? It’s very common to make Processing and Arduino communicate and I/others will help you with that.

---

<div class="post-metadata">

### Author: ![kmot](https://avatars.discourse-cdn.com/v4/letter/k/919ad9/32.png) [@kmot](https://discourse.processing.org/u/kmot)
#### Post date: [July 2, 2020, 11:49pm UTC](https://discourse.processing.org/t/data-from-pde-to-arduinio-ide-on-continual-basis/22310/3 "2020-07-02T23:49:41Z")

</div>

Please tell me how to delete my whole forum posting. I will attempt to create and post a new one. My apologies for being a dumbass nooby.

Thomas Kane / kmot

---

<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: [July 3, 2020, 9:14am UTC](https://discourse.processing.org/t/data-from-pde-to-arduinio-ide-on-continual-basis/22310/4 "2020-07-03T09:14:12Z")

</div>

Don’t put yourself down. Deleting the topic just wastes your time and everyone else’s. Better to use the time trying Arduino programs. Like I said, start with simple examples, small steps modifying towards what you want. When it goes wrong, go back 1 step, think, ask.
