Sketch not running ArrayIndexOutofBound error
Electromania opened this issue · comments
Hi,
I am trying to make your sketch run. But when compiled i get following errors
- Could not run the sketch (Target VM failed to initialize)
- ArrayIndexOutofBound at line : 205
button[p] = new Radio(35, 95+(yPos*20),12,color(180),color(80),color(255),p,button);
can you please help in understanding what is going wrong.
I just downloaded and compiled rightaway.
EM
@Electromania I just made an update to the sketch.
Please download or pull the new code and try it. It should work.
The problem is happening when the sketch tries to create a list of serial ports and associated radio buttons to allow you to select the port. The issue may be happening because you don't have many ports on your PC. When you run Arduino and select the Arduino board to program, how many ports do you see in the dropdown menu?
The sketch is adding a radio button in order to place the "Refresh Serial Ports List" selection. Actually, the sketch already refreshes the serial ports automatically, so you don't really need that line.
Try commenting out lines 203 to 206 and see if it works.
thanks, i made it work. apparently it needs some port to be ready to be opened. i was running it without connecting any arduino.
now at least the program is running : ). i will see how to get the heart beating ; ).
thanks a lot
Oh, yes. You do need to actually have a serial port.
I will post an issue about that and we will see about fixing this edge case.
Happy Heartbeats!