error arrayindexoutofboundexception: 0
in
Core Library Questions
•
4 months ago
hello i have got this processing code. but allways i get the error
arrayindexoutofboundexception: 0
- // import the processing serial libraryimport processing.serial.* ;// and declare an object for our serial portSerial port ;void setup () {// Get the name of the first serial port// where we assume the Arduino is connectedString portName = Serial . list ()[ 0 ];// initialize our serial object with this port// and the baud rate of 9600port = new Serial ( this , portName , 9600 );}void draw () {int value1 = 123 ;int value2 = 17 ;// load up all the values into a byte array// then send the full byte array out over serial// NOTE: This only works for values from 0-255byte out [] = new byte [ 2 ];out [ 0 ] = byte ( value1 );out [ 1 ] = byte ( value2 );port . write ( out );}
1