Illegal Access error?

edited January 2017 in Arduino

Hi I am using processing version 3.2.3 and have the latest arudino and firmatta libraries installed. here is my code:

import processing.serial.*;
import cc.arduino.*;
import controlP5.*;

Arduino arduino;
ControlP5 cp5;

Slider Servo1;

void setup() 
{
  size(950, 900);//Definir el tamano de la pantalla

  println(Arduino.list()[0]);// Mostrar los puertos COM disponibles
  arduino = new Arduino(this, Arduino.list()[0], 57600);//En los corchetes debes introducir el numero del COM empezando de 0,1,2,3 dependiendo los dispositivos que aparescan en la lista
  cp5 = new ControlP5(this);  

  arduino.pinMode(2, Arduino.SERVO);//Definir el pin 2 para la conexion de un servomotor

  Servo1 = cp5.addSlider("1").setRange(0,180).setValue(90).setPosition(110,110).setSize(270,25).setNumberOfTickMarks(270).setLabelVisible(false).setColorForeground(color(255,0,0)).setColorBackground(color(0,255,0)).setColorActive(color(0,0,255));

}

void draw() 
{

  background(color(10,10,10));  
  arduino.digitalWrite(2, int(Servo1.getValue()));
  textSize(50);
  text("Servo Tester", 300, 75);
  textSize(25);
  text("Servo1", 20, 125);
  textSize(18);
  text("[Pin 2]", 25, 150);
  textSize(25);
  text(int(Servo1.getValue())+"°", 390, 130);
}

I get an illegal access error at line 15 which isarduino = new Arduino(this, Arduino.list()[0], 57600); and I have no idea why? I am on win7 64 bit OS and the only comm port I have is COMM 3.You can try my code as well to see what I mean

Answers

  • to see the available ports changing line 14,

     from
            println(Arduino.list()[0]);// Mostrar los puertos COM disponibles
            to
            println(Arduino.list());// Mostrar los puertos COM disponibles
    
Sign In or Register to comment.