I am attempting a serial communication with my Arduino

I am getting an error stating the class “string” does not exist and in same block variable “port” and variable “ lastTime” does not exist .

I believe it is something to do with a serial port list for the Arduino is not correct but since I am a beginner I do not know how to correct this .

Any help appreciated

Any way to see the code that’s causing problems?

Hello @electron59,

Welcome to the forum!

This is a good place to start:
Welcome to the Processing Foundation Discourse

The Guidelines - Asking Questions is an excellent guide!

There are resources (tutorials, references, examples and more) here:
https://processing.org/

Take advantage of the search in the forum and on the main page.

Try to build your code in steps!

Save each working version and then save it as a new version to continue.
MySketch_1_0_0
My Sketch_1_0_1
And so on…

Code is not forgiving!
Pay attention to details and learn from it.
Perseverance and taking advantage of the resources and tools available to you will pay off in the long run.

A snippet of code to get you started:


// Uncomment the String declarations and see what happens!
// Try all the combinations! Each one and both.

// Declare globally:
//String string = "global"; // Declares string

void setup()
  {
  // Declare locally:
  //String string = "setup";
  
  // Trying to print string but it was note declared!
  println(string); 
  }  

This is the error I get initially:

This is the error when I click on the underlined:

It does not exist because I did not declare it globally or locally!

And have fun!

:)

Hi @elextron59, You might like this example I posted as an almost sure way to get comms running.