# Arduino, as a SCOPE

**URL:** <https://discourse.processing.org/t/arduino-as-a-scope/12483>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [July 3, 2019, 4:34pm UTC](https://discourse.processing.org/t/arduino-as-a-scope/12483 "2019-07-03T16:34:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luis](https://avatars.discourse-cdn.com/v4/letter/l/3e96dc/32.png) [@Luis](https://discourse.processing.org/u/Luis)\
**Post date:** [July 3, 2019, 4:34pm UTC](https://discourse.processing.org/t/arduino-as-a-scope/12483/1 "2019-07-03T16:34:49Z")

</div>

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

```auto
import processing.serial.Serial;
import processing.serial.*;

Serial myPort;
int xPos=1;

void setup (){
  size(400,300);
  
  println(Serial.list()); //here is the error

  myPort = new Serial(this,Serial.list()[0],9600);
  //myPort.bufferUntil ('\n');
  background(0);
             }
void draw () {
 
             }
void serialEvent(Serial myPort){
  
  String inString = myPort.readStringUntil('\n');
  
  if (inString != null){
    
    inString=trim(inString);
    
    float inByte = float(inString);
    inByte = map(inByte,0,1023,0,height);
    
    stroke(127,34,255);
    line(xPos,height, xPos,height-inByte);
    
    if(xPos>=width){
      xPos = 0;
      background(0);
                   }
    else{
      xPos++;
        }
                       }
                               }

```

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?

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [July 3, 2019, 5:11pm UTC](https://discourse.processing.org/t/arduino-as-a-scope/12483/2 "2019-07-03T17:11:02Z")

</div>

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?

Kf

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [July 3, 2019, 5:13pm UTC](https://discourse.processing.org/t/arduino-as-a-scope/12483/3 "2019-07-03T17:13:10Z")

</div>

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().

Kf

---

<div class="post-metadata">

**Author:** ![Luis](https://avatars.discourse-cdn.com/v4/letter/l/3e96dc/32.png) [@Luis](https://discourse.processing.org/u/Luis)\
**Post date:** [July 3, 2019, 5:29pm UTC](https://discourse.processing.org/t/arduino-as-a-scope/12483/4 "2019-07-03T17:29:29Z")

</div>

the error appears at the 10th line

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [July 4, 2019, 12:07am UTC](https://discourse.processing.org/t/arduino-as-a-scope/12483/5 "2019-07-04T00:07:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [July 4, 2019, 4:16pm UTC](https://discourse.processing.org/t/arduino-as-a-scope/12483/6 "2019-07-04T16:16:43Z")

</div>

You should use `printArray()` based on this [link](https://processing.org/reference/libraries/serial/Serial.html).

Kf

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [July 7, 2019, 12:19am UTC](https://discourse.processing.org/t/arduino-as-a-scope/12483/7 "2019-07-07T00:19:41Z")

</div>

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