Communicate a String of text between Processing and the Arduino

Hey everyone :slight_smile:
So i need a little bit of help with serial communication between Processing and the Arduino :slight_smile:

Basically, i want to display text on a 16x2 LCD on my arduino from a textbox on a webpage so that everyone can leave a message.
So far i've managed to create a text file from that textbox and recover it in Processing.
I also know how to use the 16x2 LCD on the arduino.

The problem i have is that i can't find a solution to get that text from Processing and send it to the arduino even though i've been searching for hours :frowning:

Here is the Processing code :
http://pastebin.com/mzZ0NVNw

 import processing.serial.*;
 Serial port;
 
 void setup()  {
  port = new Serial(this, Serial.list()[1], 9600); 
}

 void draw() {
 
  String texte[] = loadStrings("http://icore.alwaysdata.net/data.txt");
  //println(texte[0]);
 
  //port.write(texte[0]);
  
  char[] strChar;
  strChar = texte[0].toCharArray();
  
  for (int i=0 ; i <= texte.length +1 ; i++) {
    println(strChar[i]);
    delay(1000);
  }

  delay(5000);
 }

Here is the Arduino code :

const int ledPin = 13; // the pin that the LED is attached to - change this if you have a separate LED connected to another pin

String inData;

void setup() {

  Serial.begin(9600);

  pinMode(ledPin, OUTPUT);
}

void loop() {
  
  
  while (Serial.available() > 0) {
    char received = Serial.read();
    inData += received; 
    
    //inData = ""; 
   }



  if (inData == "cac") {
    digitalWrite(ledPin, HIGH);
  }

  if (inData == "lol") {
    digitalWrite(ledPin, LOW);
  }
  
  
  inData = ""; // Clear received buffer

}

You have provided code but you have not explained what it is supposed to do AND what it actually does.

This demo and this demo might give you some ideas. The PC code is in Python but the principles will be similar.

...R

port.write() is how to send data to the serial port, Why is that commented out?

Do you KNOW that the Arduino is connected to the second port in the list?

And, Robin2's question needs answering.