Arduino, as a SCOPE

I´m doing a proyect, and i need use a scope; i found this code:

import processing.serial.Serial;
import processing.serial.*;

Serial myPort;
int xPos=1;

void setup (){
  println(Serial.list()); //here is the error

  myPort = new Serial(this,Serial.list()[0],9600);
  //myPort.bufferUntil ('\n');
void draw () {
void serialEvent(Serial myPort){
  String inString = myPort.readStringUntil('\n');
  if (inString != null){
    float inByte = float(inString);
    inByte = map(inByte,0,1023,0,height);
    line(xPos,height, xPos,height-inByte);
      xPos = 0;

Processing 3.5.3 show me this:
Type String[] of the last argument to method println(Object…) doesn’t exactly match the vararg parameter type. Cast to Object[] to confirm the non-varargs invocation, or pass individual arguments of type Object for a varargs invocation.

and don´t show the signal tested.what should i do?

1 Like

Please go back and edit your post, select your code and hit the </> button to format your text as code. As it is right now, some characters might be missing. We need to see a fully formatted code to address this issue.

What line shows the error at by the way?


Also, you are drawing inside your serialEvent() function. Accessing your canvas should be done inside your draw(). In other words, move anything that touches the sketch to draw().


1 Like

the error appears at the 10th line

the measured value on a arduino might be 0 … 1023
same as you suggest in the map function.
so i see no use to try to convert that value from string into a float.

anyhow i recommend that you print that ( cleaned up ) string to console first
to see what you really get from serial port.
/ and if it match with what you see in the arduino IDE monitor,
after upload your arduino sketch

You should use printArray() based on this link.


Were you able to resolve this issue?
and get your processing/arduino scope running?