Forum

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1]
Author Topic: ArrayIndexOutOfBoundsException when attempting to select serial port
Martoon
Newbie
Posts: 11
Permalink
Post ArrayIndexOutOfBoundsException when attempting to select serial port
on: April 18, 2018, 03:06
Quote

I have an Arduino Uno, and I know polargraph_server_a1 is working correctly, because the serial monitor in the Arduino IDE shows me:

READY
POLARGRAPH ON!
Hardware: 1
MC_UNO
Loaded width:650
Loaded height:650
Loaded mmPerRev:nan
Loaded steps per rev:400
Loaded step multiplier:255
Loaded down pos:90
Loaded up pos:180
Recalc mmPerStep (nan), stepsPerMM (nan)
Recalc pageWidth in steps (-2147483648)
Recalc pageHeight in steps (-2147483648)
READY
READY

I've installed Processing 2.2.1 on my machine (I'm running Windows 10), and the polargraphcontroller sketchbook and the libraries that come with it. When I run it, I get the expected window, and everything looks okay, and I get this in the Processing output:

Running polargraph controller
Successfully loaded properties file C:\Users\MRabens\Documents\Processing\polargraphcontroller\default.properties.txt
machine size: 1179.0, 983
windowHeight:725
Polygonizer: 0
PolygonizerLength: 1.0
Tried to load vector file () but I couldn't find it.
File not found ()
Finished loading configuration from properties file.
ControlP5 2.2.5 infos, comments, questions at http://www.sojamo.de/libraries/controlP5
Serial ports available on your machine:
COM3
About to connect to serial port in slot 2
Get serial port no: 2
Attempting to connect to serial port null in slot 2 caused an exception: 2
Polygonizer: 1
PolygonizerLength: 1.0
previewPixelDensityRange: true
Polygonizer: 1
PolygonizerLength: 1.0
regenerating preview queue.
Rectangle pos: [ 10.0, 37.0, 0.0 ], size: [ 208.0, 48.0, 0.0 ].
Rectangle pos: [ 10.0, 85.0, 0.0 ], size: [ 208.0, -105.0, 0.0 ].
Target height is -61.0 pixels
845.02496
-0.072187215
New window size: 1653 x 764
New window size: 1653 x 764

I go to the SETUP tab, click SERIAL PORT...
It adds this to the Processing output:

Adding COM3
portNo: 2
Apr 17, 2018 10:01:01 PM controlP5.ControlBroadcaster printMethodError
SEVERE: An error occured while forwarding a Controller event, please check your code at button_mode_serialPortDialog
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at controlP5.ControlBroadcaster.invokeMethod(Unknown Source)
	at controlP5.ControlBroadcaster.callTarget(Unknown Source)
	at controlP5.ControlBroadcaster.broadcast(Unknown Source)
	at controlP5.Controller.broadcast(Unknown Source)
	at controlP5.Button.setValue(Unknown Source)
	at controlP5.Button.activate(Unknown Source)
	at controlP5.Button.mouseReleased(Unknown Source)
	at controlP5.Controller.setMousePressed(Unknown Source)
	at controlP5.ControllerGroup.setMousePressed(Unknown Source)
	at controlP5.ControlWindow.mouseReleasedEvent(Unknown Source)
	at controlP5.ControlWindow.mouseEvent(Unknown Source)
	at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1236)
	at processing.core.PApplet.handleMethods(PApplet.java:1431)
	at processing.core.PApplet.handleMouseEvent(PApplet.java:2826)
	at processing.core.PApplet.dequeueEvents(PApplet.java:2725)
	at processing.core.PApplet.handleDraw(PApplet.java:2397)
	at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
	at processing.core.PApplet.run(PApplet.java:2256)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
	at java.util.ArrayList.elementData(Unknown Source)
	at java.util.ArrayList.get(Unknown Source)
	at controlP5.ScrollableList.updateIndex(Unknown Source)
	at controlP5.ScrollableList.setValue(Unknown Source)
	at polargraphcontroller.addSerialPortControlFrame(polargraphcontroller.java:6220)
	at polargraphcontroller.button_mode_serialPortDialog(polargraphcontroller.java:7106)
	... 26 more

I select COM3 from the dropdown (and COM3 is correct - that's the port the Arduino is on), and it adds this to the output:

In dropdown_serialPort, newSerialPort: 1
About to connect to serial port in slot 0
Attempting to connect to serial port in slot 2 caused an exception: 2

The polargraphcontroller window continues to show "No serial connection." at the top, and never connects.

Martoon
Newbie
Posts: 11
Permalink
Post Re: ArrayIndexOutOfBoundsException when attempting to select serial port
on: April 18, 2018, 03:21
Quote

Hmm. I fiddled with it some more, and discovered that if I selected NO SERIAL CONNECTION, then select COM3 again, it successfully connects. I have to do this every time I run the controller app, but I have a working workaround.

allen00se
Newbie
Posts: 1
Permalink
Post Re: ArrayIndexOutOfBoundsException when attempting to select serial port
on: January 31, 2020, 16:52
Quote

I had the same issue and used the same resolution to fix it. Thanks!

Pages: [1]
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.016 seconds.