adapted from here .

// Example by Tom Igoe

import processing.serial.*;

Serial myPort;    // The serial port
PFont myFont;     // The display font
String inString;  // Input string from serial port
int lf = 10;      // ASCII linefeed

void setup() {
  // List all the available serial ports:
  // Open the port you are using at the rate you want:
  myPort = new Serial(this, Serial.list()[0], 9600);


void draw() {

  text("Received: " + inString, 10, 50);

void serialEvent(Serial myPort) {
  inString = myPort.readString();

i removed the annoying unsupported custom font the author included (in a beginner’s example in such a fundamental piece of code . . .

So, you will see, if you run the code printed in the console :


You would already know which COM port your arduino is using by looking at device manager or wait for the arduino ide to be refreshed and then look under the tools tab

now in this :

 myPort = new Serial(this, Serial.list()[0], 9600);

change the [0] to what your arduino is using. like if COM22 use [10], simple!